
S1C88409 TECHNICAL MANUAL
EPSON
233
APPENDIX: CONTROLLING THE TOUCH PANEL CONTROLLER
LD
[BR:@LOW(IO_PRE6)],#00001100B
;TPC clock = fOSC3/16
;TPC clock is turned on
(4) Set the TPC modes
LD
[BR:@LOW(IO_PRE7)],#00000000B
;TPC noise rejection on
;TPC noise rejection
;f.ratio = fOSC1/1
LD
[BR:@LOW(IO_TPCR0)],#00010011B
;CONST moving average
;average times = 16 * 2
LD
[BR:@LOW(IO_TPCR1)],#00001111B
;voltage stability wait
;time = 16 * 16/f
LD
[BR:@LOW(IO_TPCR2)],#00001111B
;noise detection threshold
;= 64
LD
[BR:@LOW(IO_TPCR3)],#00001111B
;pen up detection threshold
;= 64
;setting speed detection
;threshold
LD
[BR:@LOW(IO_TPCR4)],#01000010B
; SSDT = 6
;MSSDT = 10
LD
[BR:@LOW(IO_TPCR5)],#10000110B
;MFSDT = 14
; FSDT = 18
LD
[BR:@LOW(IO_TPCR6)],#00000010B
;wait time after A/D conv.
;= 128 * 3
(5) Activate the TPC circuit
OR
[BR:@LOW(IO_TPCR0)],#00100000B
;lift a reset of TPC circuit
(8) Reset the coordinate update interrupt flag and enable the interrupt
LD
[BR:@LOW(IO_INTFA3)],#01100000B
;TP pen down interrupt
;factor flag reset
OR
[BR:@LOW(IO_INTEA3)],#00100000B
;TP data renewal interrupt
;enable
(9) Restore the saved registers
POP
A
POP
SC
RET
A.5.3 TPC data update interrupt processing
;###############################################################################
;
pen move interrupt loutine
;
input
none
;
output
none
;
destroyed
none
;###############################################################################
GLOBAL
INT_PMOVE
INT_PMOVE:
(1) Save the registers
PUSH
BA
PUSH
L
(2) Pen-down check
BIT
[BR:@LOW(IO_TPCR7)],#00000001B
;if pen down is detected
JRS
Z,INTPMOVE10
;then read the coordinate
;data
(3) Process when a pen-down is detected
Set the switch data to "1"
M_BSET
tpc_flg0,TC_SWITCH0,A
;switch0 = 1
Load X coordinate data
LD
B,[BR:@LOW(IO_TPCR8)]
;B = x11 - x04
LD
A,[BR:@LOW(IO_TPCR9)]
;A = x03 - x00
PACK
;A = x07 - x00
LD
L,A
;L = A
LD
A,B
;A = B