background image

AP08113

Capacitive-Touch Color Wheel Implementation

Implementation of Color Wheel Software

 

Application Note

8

V1.0, 2010-08

 

The pad detection period depends on many parameters, such as the number of pad turns and LED columns
enabled and the accumulation of SFR LTS_TSVAL for example. The ‘All Enabled Pads Accumulated Count
Period’ (AEPACP) is 8.96ms, as defined in 

Equation (1)

. The ShortCount determines the minimum ‘valid pad

detection period’ (VPDP). The minimum valid pad detection period is 71.68ms, calculated as shown in

Equation (2)

.

(1)

where:

TFD is Time Frame Duration = (((PREscaler x 256)/fCLK) x (Number of Time Slice(s))) = ((42 x 256) / 48MHz) 
x 2 Time Slices = 448

µ

s

Number of Touch-sense inputs is 4

AccumulatorCounter is defined as 4 in the software code.

(2)

where:

ShortCount is defined as 0xF8 in the software code

A long touch on the centre button is detected when both PadDownCounter (PDC) is 0x40 and PADFLAG.4 is 1.
This long touch period is 1.71s, defined in 

Equation (3)

. If a longer detection period is required, modify PDC to a

smaller value. 

(3)

The maximum valid pad detection period is 2.28s, as defined in 

Equation (4)

. For this period, the code can be

modified such that PADERROR.3 = 1, indicates a long touch on the centre button.

(4)

Note: PDC is used to keep track of how long the pad is touched. PDC is initialized to be 0xFF at the start of a 

detected pad touch, and is decremented once at each All Enabled Pads Accumulated Count Period 
(AEPACP). When pad touch is removed, PDC is compared with the user input value, ShortCount, and/or 
0x00 to decide if pad touch is valid, invalid or a long touch. PDC is one of the parameters stored in XRAM, 
at address 0xF0FF, by the FINDTOUCHEDPAD function.

Note: Please refer to LEDTS ROM Library in the User’s Manual for more details of the FINDTOUCHEDPAD 

function, its inputs and its formulas.

3.1.2

Touch Detection Methodology for the Touch-Wheel

The Touch-Wheel Library (Library_TouchWheel.lib linked into the application code and programmed in the flash
memory) is used to detect a touch on the touch-wheel. It is provided as a .lib file and is described in 

Section 3.2

.

The Touch-Wheel Library makes use of the AverageL/H values calculated by the LEDTS ROM Library to
determine the absolute location of the current finger touch on the touch-wheel. In order to keep the averaging
active, the PADFLAG bits are cleared for touch-sense inputs TSIN0, TSIN1 and TSIN2.

AEPACP

TFD

Number of Touch-sense inputs TSIN[x]

(

)

×

AccumulatorCounter 1

+

(

)

×

=

Minimum Valid Pad Detection Period (VPDP)

0xFF ShortCount

1

+

(

)

AEPACP

×

=

Long Touch Period

0xFF PDC

(

)

AEPACP

×

=

Maximum Valid Pad Detection Period (VPDP)

0xFF AEPACP

×

=

All manuals and user guides at all-guides.com

Summary of Contents for XC800 AP08113

Page 1: ...XC800 Family AP08113 Capacitive Touch Color Wheel Implementation Microcontrollers Application Note V1 0 2010 08 All manuals and user guides at all guides com a l l g u i d e s c o m...

Page 2: ...LICATION NOTE Information For further information on technology delivery terms and conditions and prices please contact the nearest Infineon Technologies Office www infineon com Warnings Due to techni...

Page 3: ...last revision This is the first release We Listen to Your Comments Is there any information in this document that you feel is wrong unclear or missing Your feedback will help us to continuously improv...

Page 4: ...heel Function 9 3 2 2 Calc_Compensation Function 9 3 3 RGB LED 10 3 4 Overview Flow Chart of Color Wheel Software Code 11 4 Modifying Color Wheel Software Code 12 4 1 User Defined Parameters 12 4 2 DA...

Page 5: ...ary to create their own XC822T1 solution The source code provided can be modified and compiled with the free DAvE Bench tool chain The user can download the code into flash execute it and observe the...

Page 6: ...d the third selects Hue The respective LED above the touch wheel will indicate the current color mode selection The main LED is a 3 channel RGB LED D2 where the color is a combination of the three cha...

Page 7: ...PADERROR of the LEDTS ROM Library FINDTOUCHEDPAD function There are two touch detection methodologies used in the Color Wheel Application Kit LEDTS ROM Library touch detection methodology Touch Wheel...

Page 8: ...DC is used to keep track of how long the pad is touched PDC is initialized to be 0xFF at the start of a detected pad touch and is decremented once at each All Enabled Pads Accumulated Count Period AEP...

Page 9: ...0 The parameters include compensation for wheel2 and wheel1 amplitude threshold and filter gain Refer to Section 4 1 for descriptions of the user defined parameters Address pointer of touch wheel angl...

Page 10: ...converted to an RGB value via the HSL_TO_RGB function and the CCU6 registers are programmed where their respective pins are connected to the RGB LED Figure 3 HSL to RGB LED Block Diagram Table 2 Speci...

Page 11: ...color mode is enabled y Change colur mode and respective LED3 2 1 loop Centre button is touched n y Centre button is touched for long period n Enter Power Down Mode Disable interrupts Disable WDT if e...

Page 12: ...fy 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...

Page 13: ...respective folder To select the required configuration select Project Properties C C Build Settings Manage Configurations Activate this option To view the differences between the Debug and Release co...

Page 14: ...ch Color Wheel Implementation Modifying Color Wheel Software Code Application Note 14 V1 0 2010 08 Figure 5 DAvE Bench GUI for Compiling the Color Wheel Software Code 5 1 2 3 4 All manuals and user gu...

Page 15: ...e software updating Once the code is verified the user can re program the device to User Mode Productive Attention It is recommended to program BMI to UART BSL Mode before updating the software code T...

Page 16: ...al interrupt Control Register 0 SFR_PAGE _su3 noSST switch to page 3 without saving MODPISEL1 0x18 peripheral input select register 1 SFR_PAGE _su0 noSST switch to page 0 without saving End of functio...

Page 17: ...is therefore re entered and the latest SFR LTS_TSVAL value is re saved The cycle then repeats If the SFR LTS_TSVAL value is less than or equal to the saved_value it means that the centre button is be...

Page 18: ...lor Wheel Board Figure 6 shows the component layout of the Color Wheel board while Figure 7 Figure 8 and Figure 9 show the schematics of the XC822T device USB interface and power supply on the Color W...

Page 19: ...on Schematics and Layout of the Color Wheel Board Application Note 19 V1 0 2010 08 Figure 8 Schematic of USB Interface on the Color Wheel Board Figure 9 Schematic of power supply of the Color Wheel Bo...

Page 20: ...lor Wheel Board Application Note 20 V1 0 2010 08 Figure 10 and Figure 11 show the top and bottom layout of the Color Wheel board respectively Figure 10 Top Layout of the Color Wheel Board Figure 11 Bo...

Page 21: ...applications The Infineon touch sensing solution described in this document is a total solution on chip comprising optimized hardware and effective software functions running from ROM By taking the e...

Page 22: ...Published by Infineon Technologies AG w w w i n f i n e o n c o m All manuals and user guides at all guides com...

Reviews: