Sub Lcd_read_touch()
Local Tx As Word , Ty As Word
Local Res As Single
Touch_flag = 0
Clock = 0
Cst = 0
Waitms 10
Shiftout Dout , Clock , X_dout , 1 , 8 , 40
Waitms 5
Shiftin Din , Clock , Touchx , 1 , 16 , 40
Shiftout Dout , Clock , Y_dout , 1 , 8 , 40
Waitms 5
Shiftin Din , Clock , Touchy , 1 , 16 , 40
Cst = 1
Tx = Touchx And &B0111_1111_1111_1000
Shift Tx , Right , 3
' Print "x-l1= " ; Tx
Tx = Tx - 400 'wert zwischen 1 und 240 zb 478 für x=1 und 3712 für x=240 then 3312/ 78 = 13.47
Res = Tx / 13.75
Touchx = Int(res)
Ty = Touchy And &B0111_1111_1111_1000
Shift Ty , Right , 3
' Print "y-l1= " ; Ty
Ty = Ty - 280
Res = Ty / 10.53
Touchy = Int(res)
If Touchx > 240 Then Touchx = 0
If Touchy > 320 Then Touchy = 0
Touchy = 320 - Touchy 'Y wert gedreht für display
' Print "x-l= " ; Touchx
' Print "Y-l= " ; Touchy
'Waitms 500
Touch_flag = 0
End Sub