Datasheet

SAM9G45 [DATASHEET]
Atmel-6438O-ATARM-SAM9G45-Datasheet_08-Dec-15
940
39.10.2 Touchscreen Mode
Writing TSAMOD to “Touchscreen Only Mode” automatically enables the touchscreen pins as analog inputs, and
thus disables the digital function of the corresponding pins.
In Touchscreen Mode, the channels 0 to 3 corresponding to the Touchscreen inputs are automatically activated
and the bits CH0 to CH3 are automatically set in the “TSADCC Channel Status Register” .
The remaining channels can be either enabled or disabled by the user and their conversions are performed at the
end of each touchscreen sequence.
The resolution is forced to 10 bits, regardless of the LOWRES bit setting.
At each trigger, if the bit PRES in “TSADCC Mode Register” is disabled, the following sequence is performed to
measure only position.
1. If SLEEP is set, wake up the ADC cell and wait for the Startup Time.
2. Close the switches on the inputs X
P
and X
M
during the Sample and Hold Time.
3. Convert Channel X
M
and store the result in TSADCC_CDR1.
4. Close the switches on the inputs X
P
and X
M
during the Sample and Hold Time.
5. Convert Channel X
P
, subtract TSADCC_CDR1 from the result and store the subtraction result in both
TSADCC_CDR0 and TSADCC_LCDR.
6. Close the switches on the inputs X
P
and X
M
during the Sample and Hold Time.
7. Convert Channel Y
P
, subtract TSADCC_CDR1 from the result and store the subtraction result in both
TSADCC_CDR1 and TSADCC_LCDR.
8. Close the switches on the inputs Y
P
and Y
M
during the Sample and Hold Time.
9. Convert Channel Y
M
and store the result in TSADCC_CDR3.
10. Close the switches on the inputs Y
P
and Y
M
during the Sample and Hold Time.
11. Convert Channel Y
P
, subtract TSADCC_CDR3 from the result and store the subtraction result in both
TSADCC_CDR2 and TSADCC_LCDR.
12. Close the switches on the inputs Y
P
and Y
M
during the Sample and Hold Time.
13. Convert Channel X
P
, subtract TSADCC_CDR3 from the result and store the subtraction result in both
TSADCC_CDR3 and TSADCC_LCDR.
14. If Channel 4 to Channel 7 are enabled, convert the Channels and store result in the corresponding
TSADCC_CDRx and TSADCC_LCDR.
15. If SLEEP is set, sleep down the ADC cell.
The resulting buffer is 16 bits wide and its structure stored in memory is:
1. X
P
- X
M
2. Y
P
- X
M
3. Y
P
- Y
M
4. X
P
- Y
M
5. AD4 to AD7 if enabled.
The vertical position can be easily calculated by dividing the data at offset 0 (X
P
- X
M
) by the data at offset 1 (Y
P
-
X
M
).
The horizontal position can be easily calculated by dividing the data at offset 2 (Y
P
- Y
M
) by the data at offset 3 (X
P
- Y
M
).