This example provides users the ability to read out system status and to transmit values to control their end design. The example illustrates this through a simple CapSense button and an LED. Very often when developing a system you will want to monitor when actions are being taken and then transmit data to the system to initiate a state or control. In this example we read out button touches and display that value to our Bridge Control Panel bar chart. We can then send data to the Pioneer board to flip an LED on or off.
Forum Post Attachments:
At the bottom of this post we are including the following items:
- Example Project Zip File
- Bridge Control Panel Files
- Zip File of Images
- Project Schematic
- Component Configurations
The user can download the example project at the bottom of this post. The project uses the following list of Creator Components:
The components are configured by right clicking on the component in your Top Design schematic view and selecting Configure. Please enable the following selections in the Configuration windows for the listed components above.
The main.c firmware is included in the example project. Please review the commented sections for more details.
The firmware of this project is straight forward. We can either receive and/or transmit up data from our system. In one use case we can read out the state of the CapSense button (is it pressed is it not pressed). In the second use case we send a value to the PSoC and we either turn on or turn off the LED.
As part of this example we include the IIC and INI files for the Bridge Control Panel. The IIC files can be opened in the Bridge Control Panel and include the command examples. The INI file covers the variable settings. The variable settings are used by the read action and the charting window.
The Bridge Control Panel is installed with the PSoC Programmer installation.
You will need to make sure you have the Pioneer Kit plugged in to the PC before using the Bridge Control Panel. Simply connect to the Kit in the port window. It will be listed as a 'KitProg'. The I2C protocol will be selected automatically.
Load the IIC and INI files. You can load the IIC files by selecting the open file button and navigating to the files included in this post. Next click the variable settings button or navigate to Chart>Variable Settigns. Click the load button and select the INI file included in this post. Select OK to return to the Bridge Control Panel window.
First we'll work with the write command in the editor window. You will see we use the following symbol to comment out the read command ';'. Make sure your cursor is placed on the write command line. The Bridge Control Panel uses the cursor to determine the command to send. The first command we'll send is:
w 8 01 p
To send the command click the Send button. This command sends a write command to the PSoC 4 using I2C address 8 and sending value 01. This will turn the LED off. Simply change the 01 to 00 and send the command again. You will see the LED turn on.
Next comment out the write command and decomment the read command using the ';' character. You will see that in our read command we use the '@key1' variable. This variable was defined in our INI file and associates the value received to that variable.
r 8 @key1 p
Again make sure the cursor is placed on the read command line. We can either send this command once using the Send button or we can continuously repeat this command using the Repeat button. By hitting the Repeat button this will enable us to chart the values received in real time. Click the Repeat button and you should see a stream of data in the output window. Click on the Chart tab while the data is Repeating. Then touch the CapSense button P1.1 to see the chart update with the button status.
If you happen to have the Line Plot option simply change that to the Bar Graph option. This selection is at the bottom right of the charting window.
Simply click the Stop button to end the Repeat data collection.
The chart is only displaying the 00 or 01 value. The chart can display values of more than 1. For example if you want to chart or plot the current value being read by the ADC the BCP chart will handle that. To think of it that sounds like a great example
There are many more options in the Bridge Control Panel so take some time to review the help guide.
There are no hardware connections for this example.
Test Your Project:
Once the kit is programmed with the example project then the user will be able to launch the Bridge Control Panel to read out the CapSense state or control the LED.
I hope this example can help you out in your design.