cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4

ChHs_4614611
New Contributor II

HI,

I use capsense function for my company new vehicle air condition HMI product.

Some key will auto trigger in EMS test. (Fail frequency in the  10~12 MHz)

Capsense setting is manual In PSoC creator. (If set Auto some keys are too sensitive)

My key press detect code in the below.

Are there any code design suggestions under the interference of EMS?

capsens2.jpg

capsens1.jpg

0 Likes
1 Solution
Hari
Moderator
Moderator

Hi ChHs_4614611

In the code, you are scanning the sensors continuously. CapSense_ScanAllWidgets must be called if CapSense block is free. that is, The CapSense_ScanAllWidgets must also be inside the if (CapSense_NOT_BUSY == CapSense_IsBusy()) statement.

Thanks,
Hari

View solution in original post

4 Replies
Hari
Moderator
Moderator

Hi ChHs_4614611

In the code, you are scanning the sensors continuously. CapSense_ScanAllWidgets must be called if CapSense block is free. that is, The CapSense_ScanAllWidgets must also be inside the if (CapSense_NOT_BUSY == CapSense_IsBusy()) statement.

Thanks,
Hari

View solution in original post

ChHs_4614611
New Contributor II

Dear Hari,

    Thanks for your reply.

     So do I just add CapSense_ScanAllWidgets in this line?

capsense3.jpg

0 Likes
Hari
Moderator
Moderator

Hi ChHs_4614611

This is not correct. CapSense_ScanAllWidgets will return to program execution since it is interrupt based. So, you must call this after CapSense_ProcessAllWidgets(). The correct implementation is

if(CapSense_NOT_BUSY == CapSense_IsBusy())

{

CapSense_ProcessAllWidgets();

CapSense_ScanAllWidgets();

.

.

.

.

}

Please refer any CapSense related Code example for details on implementation.

You must also remove the scanallwidgets from the bottom portion (last line of the code snippet).

Thanks,
Hari

ChHs_4614611
New Contributor II

OK, I see.

Thank you for your reply.

0 Likes