19.3 Application for Touch Button Mod
19.3.1 The process of reading “data of touch button” in query mode
1. Enable input of the corresponding IO (including key port and the sensitivity adjustment capacitor
port);
2. Set the TKEN bit in KEYCON2 as 1;
3. Set the touch button control register KEYCON1 (including channel selection, touch button detected
clock configuration, negative voltage of comparator configuration;
4. Set the KEYCON2 (digital filter selection, frequency hopping selection);
5. Set the touch button control register KEYCON1(including touch button clock source selection, etc.);
6. Set the touch button control register KEYCON0 (enable the capacitor and select whether the Internal
shunt capacitor of key port is needed);
7. Set the 0th bit KEN of KEYCON0 from high to low, start the touch button detection;
8. Judge whether the 7th bit KDONE of KEYCON0 is high;
9. Read the 16bits data;
10. Finish touch button detection: KEN=0;
11. Return to step 3 to continue the detection of next channel.
Example: detection of touch button (KEY0) in query mode
; set the negative voltage of comparator, and the
detected clock and channel of touch button