cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

Can you give me some code(program) example for capsense .

0 Likes
Reply
9 Replies
Employee

Hi,

   

 

   

What Cypress development kit do you have? 

   

 

   

The most commonly used kits for experimenting with CapSense:

   

 

   

1. CY8CKIT-001 PSoC® Development Kit with CY8CKIT-020 PSoC® CY8C28 Family Processor Module Kit

   

2. CY3214-PSoCEvalUSB PSoC CapSensePLUS with USB Evaluation Kit

   

3. Other kits which support CapSense - http://www.cypress.com/?app=search&searchType=advanced&keyword=capsense&rtID=110&id=0&applicationID=...

   

 

   

 

   

If you already have one of the above kits, navigate to the webpage for your kit on Cypress.com and scroll down; you will be able to see some attachments - Code examples.zip or the Kit user guide, which will contain example projects or information on how you can create one.

   

 

   

 

   

Regards,

   

Arvind

0 Likes
Reply
Esteemed Contributor

A useful reference page -

   

 

   

http://www.cypress.com/?id=1575&tabID=39265

   

 

   

Regards, Dana.

0 Likes
Reply
Employee

 There are bunch of code examples available for different devices on the following pages:

   

http://www.cypress.com/?rID=36805

   

http://www.cypress.com/?app=search&searchType=advanced&keyword=&rtID=113&id=0&applicationID=0&l=0&so...

   

 

   

Cheers,

   

Pushek

0 Likes
Reply
Anonymous
Not applicable

hi,

   

Thanks to all.

   

Your information is very helpful. I have kit CY32x80. I working on device CY8C20434LKXI for practice. Source code have 5 buttons and one slider.

   

I want to add few more sensor(10 buttons and 2slider) in my project touch pad, please tell me what changes i have to make in source code and other settings for same device CY8C20434-LKXI.

   

Pramod.

0 Likes
Reply
Employee

Hello Pramod,

   

 

   

If you already have the project with 5 buttons and 1 slider, in order to expand the same to 10 buttons and 2 sliders - you can follow the below steps -

   

 

   

1. First check pin requirements for the design- 10 buttons with 2 sliders each having 10 segements requires 30+1 pins; Since you are using CY8C20434 device which has just 28 I/Os, you cannot use a 10 segment slider. Either choose a higher pin part device or use a lower segment count sliders - say two 5 segement sliders or one 5 segemnt and one 10 segment slider.

   

 

   

2. If you are done with the above, you can now proceed to setting the number of buttons/sliders. In the chip editor view, right click (either in chip editor or workspace explorer) on your CapSense UM and Select CSA wizard ( or CSA_EMC wizard if you are using CSA_EMC)

   

 

   

3. In wizard you can simply type the number of buttons you want in the Buttons field and Number of sliders you want in the sliders field (these options are in the Global settings tab) - Enter 10 against buttons and 2 against sliders for your case.

   

 

   

4. Now click on Slider S1 in the right side pane - it will get highlighted in red indicating it is selected.

   

 

   

5. Now click on the sensor settings tab, in this tab, against the Sensors count field enter the number of segments you want in this slider - say 5 segments. You can select the resolution and Diplex option as well - refer UM datasheet for complete details on these parameters (Right click on the UM and then click on Datasheet)

   

 

   

6. Now Follow step 4 & 5 for Slider S2

   

 

   

7. Once you are done, you need to assign pins for the sensors. You can do the same by either simply clicking-dragging-dropping the button or slider segment on to a pin in Chip pin assignment view (if you want to assign by chip pin wise) or Table pin assignment view (if you want to go by port pin wise)

   

 

   

8. Once you have assigned all the sensors to a pin and selected ExternalCap (P0[3] for CY3280 board) in the Global settings, click Ok to save/close the configuration wizard.

   

 

   

9. Now build your project by pressing F6 or Build -> Generate/Build

   

 

   

10. Now in the project, in the UpdateI2CBuffer API, you can access CSA_baSnsOnMask[0] and [1] for reading the button status. Note that CSA_baSnsOnMask[0] will have button status of Button 0 to Button 7 (from LSB to MSB) and CSA_baSnsOnMask[1] will have button status of Button 8 to Button 15. Since there are just 10 buttons in our design, the MSB 5 bits of this register is of no use. Accordingly you can modify the code to get the status of that particular button.

   

 

   

11. In the same function, where you are calling CSA_wGetCentroidPos(1) - you can call CSA_wGetCentroidPos(2) to read the status of Slider S2. You can do a similar processing for Slider S2 like done for Slider S1 to implement both Slider S1 and S2.

   

 

   

12. Remember if you are adding an extra variable to the I2C buffer, define the same in the structure defined in 'main.h'

   

 

   

Hope this helps.

   

If you need let me know, I can post some screenshots for clarity.

   

 

   

Regards,

   

MSUR

0 Likes
Reply
Anonymous
Not applicable

Hi MSUR,

   

                Thanks MSUR, your informatin is very helpful for me.  one small question is same code will work on another device (eg. code for CY8C20434-LKXI on CY8C20434-LQXI).

   

pramod.

0 Likes
Reply
Anonymous
Not applicable

hi MSUR,

   

Two errors occurred in project. can you give some solution.

   

!E <library>(3385): {linker} Cannot allocate space for 96 bytes for 'ram0' area
C:\PROGRA~1\Cypress\PSOCDE~1\5.2\Common\CY3E64~1\tools\make: *** [output/Ten_button_Two_Slider.rom] Error -1

   

pramod.

0 Likes
Reply
Anonymous
Not applicable


Hi  MSUR,

   

Why resource meter window appears black. I attach Screen shot. With reference to aove error.

   

pramod

0 Likes
Reply
Anonymous
Not applicable

Hi

   

Manage to solve above problems.

   

Thank You.

   

Pramod

0 Likes
Reply