Touch-screen Initialization
1. Set the ad conversion clock
Adccon (1<<14) | (49<<6) Prscen Enable PRSCVL adc=pclk/(val+1)
2. Set Interrupt Masking
2.1.TC interrupts, which can occur when a finger touches or moves away
2.2.ADC interrupt, interrupt generated when ADC conversion is complete
Enable TC Interrupt, shielded ADC interrupt, poll to see ADC interrupt
Intmsk ~ (1<<31)
Intsubmask ~ (1<<9)
3. Enter the wait interrupt mode (press)
ADCTSC 0xd3
TC Interrupt Handling
1. Start XY coordinate auto-conversion
ADCTSC (1<<2)
Adccon (1<<0)
2. Wait for the conversion to complete, get the coordinates
Judge Adccon's 15-bit
Get the x-coordinate in ADCDAT0
Get the y-coordinate in ADCDAT1
3. Clear interrupts
SUBSRCPND's 9-bit
SRCPND's 31-bit
INTPND's 31-bit
4. Enter standby interrupt mode (bounce)
ADCTSC 0xd3
ADCTSC 8th bit set to 1
5. Clear interrupts
6. Enter the wait interrupt mode (press)
[Country EMBED strategy] [062] [Touch screen working principle analysis]