Datasheet

CY8C20xx6A/H CapSense Design Guide Doc. No. 001-65973 Rev. *A 39
SmartSense_ScanAllSensors();
SmartSense _UpdateAllBaselines();
if(SmartSense _bIsAnySensorActive() )
{
//1mS firmware routines
}
}
This means that, upon the activation of a CapSense sensor, firmware produces the sensor ON status within 7.35 ms
(the sensor should be active for Debounce number of consecutive scans). This is often referred to as the response
time of CapSense system.
If the scan time varies with respect to the parasitic capacitance to maintain consistent , what is the impact on
response time if the parasitic capacitance of the sensor changes due the process variation? Response time may be
increased (slow response) in this case. This can have a negative impact on sensor performance. Guidelines to build
a robust firmware design are provided below.
4.4.6 Firmware Design Guidelines
The response time of the CapSense sensors may change due to the increased parasitic capacitance of the sensor. IT
is also important to watch the loop execution time (see the following example code), which may also increase. When
the parasitic capacitance of all sensors was less than 10 pF, the firmware routine was executed at a rate of 2.45 ms.
This rate will be modified if the sensor scan time is increased because of the increase in the parasitic capacitance of
the sensor based on the process variation.
The following is example code for toggling a port pin based on the main loop execution time.
while (1)
{
SmartSense_ScanAllSensors();
SmartSense_UpdateAllBaselines();
if(SmartSense_bIsAnySensorActive() )
{
//1 ms firmware routines
}
PRT0DR_Shadow ^= 0x01;
PRT0DR = PRT0DR_Shadow;
}
The period of the signal on Port_0[1] pin is 4.9 ms (the period is twice the loop time as the port pin is toggled). If the
parasitic capacitance of one sensor is increased to approximately 15 pF, the scan time will change to 1.78 ms; thus,
the period of signal on the Port_0[1] will be 5.6 ms.
If the parasitic capacitance of the sensor is close to the boundary of the SmartSense capacitance banks (for example,
9 pF, which is very close to the 10-pF boundary), SmartSense may choose a neighboring scan time in an application
due to process variation. Because of this, different production parts of the same design can have two different main
loop execution times and response times.
Based on the above discussions, firmware should not rely on the scan time of the sensor for implementing other
features (for example, software PWM, software delay, and so on). Programs implementing watch dog timer (WDT)
should consider this fact while setting the WDT expiration time
A simple firmware implementation example to get a consistent main loop execution time using Timer16 User Module
follows.
// Main program
BYTE bTimerTicks = 0;
#pragma interrupt_handler myTimer_ISR_Handler;
void myTimer_ISR_Handler( void );
void main()
{
M8C_EnableGInt;