
AP08113
Capacitive-Touch Color Wheel Implementation
Modifying Color Wheel Software Code
Application Note 12 V1.0, 2010-08
4 Modifying Color Wheel Software Code
The Color Wheel software example code can be accessed and modified by the user with DAvE-Bench - Infineon’s
free tool chain. The user can modify the user-defined parameters (as described in Section 4.1), the timing, code
flow, enabling/disabling modules, and interrupts handling for example, as required for a specific application. The
Color Wheel software example code can be downloaded together with this application note.
4.1 User-Defined Parameters
There are 6 parameters which the user can modify for the Touch-Wheel Library based on their application board
and usage. The respective values and description are listed in Table 3.
The threshold value can be reduced to increase sensitivity, and the filter gain value can be reduced to allow a
faster response time. The user can modify the user-defined parameters to match their application. The estimated
compensation values for Wheel1 and Wheel2 can be obtained by calling Touch-Wheel Library function as
described in Section 3.2.2.
4.2 DAvE-Bench Tool
The Infineon’s free tools DAvE and DAvE-Bench are used to generate and compile the code for Color Wheel
application. The user should follow the procedure shown below and in Figure 5, when using DAvE-Bench to
modify and compile the code.
Procedure to modify Color Wheel Application software code:
• Download and install DAvE-Bench (www.infineon.com/dave-bench)
• Define a workspace for DAvE-Bench
• Click “File” -> “Import” -> “XC800” -> “Existing Project”
• Select the desired folder where the project exists (RGB_Wheel folder)
• Default: Tick option - copy project into workspace (Future changes will be reflected at the project in the
workspace, while original copy remain unchanged)
• Click “Finish” to import the project
• Modify the software code
• Click “Project” -> “Build Active Project” to compile the code
• Check the status of compilation on “Console” box
• If compilation is not successful, the bugs are listed in the “Problems” box
• Once hex file is generated, download the hex file using DAvE-Bench (XC800_FLOAD), described further in
Chapter 5.
Table 3 User-Defined Parameters for Color Wheel Software Code
Parameter Current Value Description
COMPENSATION_WHEEL2 -11 Compensation value for Wheel2 due to environment
COMPENSATION_WHEEL1 -11 Compensation value for Wheel1 due to environment
AMPLITUDE_THRESHOLD 0x400 Threshold value for amplitude. Above threshold value is
considered as touch on the touch-wheel
AMPLITUDE_FILTER_GAIN 5 Filter gain value for amplitude
AMPLITUDE_START_VALUE 0x240 Start value for amplitude during initialization/start-up
TSVAL_SUBTRACTION 3 To wake up the device via centre button
Subtraction value to determine the threshold level.
Current TSVAL > (Saved TSVAL - SUBTRACTION)
means the centre button is detected as “no touch” - device
remains in Power Down Mode