How to read raw counts from sensing elements in a capsense widget?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
jcsb1994
Level 4
Level 4
First solution authored 50 replies posted 50 sign-ins

Hi,

I want to read raw counts from a CSX touchpad widget using PSOC 6. I have been skimming through the capsense datasheet but didn't quite understand how to do it. I wanted to look for an example using capsense rawcounts but didn't find one in psoc creator. I believe I can get the raw counts using self-test API, then again I am not sure how to do it. Is there a simple code snippet or small explaination I could get that could help me get started reading rawcounts from my widgets?

Thank you!

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi JeSi_4326976

You can use the CapSense_GetParam to read the raw counts from CapSense widget. The first parameter is the paramID present in CapSense_RegisterMap.h and the second parameter is the address of the variable where value needs to be stored.

I'm attaching a simple project to show this for CapSense buttons with this response.

Do try this out.

Thanks,

Hari

View solution in original post

2 Replies
lock attach
Attachments are accessible only for community members.
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi JeSi_4326976

You can use the CapSense_GetParam to read the raw counts from CapSense widget. The first parameter is the paramID present in CapSense_RegisterMap.h and the second parameter is the address of the variable where value needs to be stored.

I'm attaching a simple project to show this for CapSense buttons with this response.

Do try this out.

Thanks,

Hari

YoOb_1790021
Level 5
Level 5
Distributor - Marubun (Japan)
First solution authored 10 likes received 10 likes given

Hi,

I think you can read these values through the dsRam.

Please see the Data Structure Description in the PSoC 6 Capacitive Sensing Component datasheet.

(Also see "To access CapSense Data Structure registers you have the following options:")

You can try to get the register map on your design as below.

Right clock on CapSense Component on your TopDesign.cysch window, and click "Save Register Map as PDF".

And search "RAW" on this PDF.

raw.jpg

For example, the LED trun on, when the button is touched and the raw counts is grater than some value.

    uint16 testval;

    testval = CapSense_dsRam.snsList.btn0[0u].raw[0u];

    if(testval > 2000) LED_13_Write(LED_ON);

(You can use also CapSense_GetParam() function.)

Sorry, now I have only PSoC 4 board. (PSoC 6 is in my office.)

So, I cannot give you complete example code.

I think the below thread also helpful.

https://community.cypress.com/message/212561

https://community.cypress.com/message/158491

BR.