MAX1233/MAX1234触摸屏控制器入门
时间:03-17
来源:互联网
点击:
DEMO1234 Command
Action SPI data in
Verification Optional: connect oscilloscope to PENIRQ-bar I C 1 3
Configure PENIRQ-bar pulse accumulator: falling-edge trigger I 0 1
Reset the pulse accumulator I R 1
Read the number of times PENIRQ-bar has pulsed low count = 0 T W AC 8bff
Wait for touch, then scan X,Y,Z1,Z2 0x0040 0x8bff
Touch the touch screen PENIRQ pulse I R 1
Read the number of times PENIRQ-bar has pulsed low count has increased T R P
Read X,Y,Z1,Z2 conversion results 0x8000 0x0000
0x8001 0x0000
0x8002 0x0000
0x8003 0x0000
Touch the touch screen PENIRQ pulse I R 1
Read the number of times PENIRQ-bar has pulsed low count has increased T R P
Read X,Y,Z1,Z2 conversion results 0x8000 0x0000
0x8001 0x0000
0x8002 0x0000
0x8003 0x0000
Touch the touch screen PENIRQ pulse I R 1
Read the number of times PENIRQ-bar has pulsed low count has increased T R P
Read X,Y,Z1,Z2 conversion results 0x8000 0x0000
0x8001 0x0000
0x8002 0x0000
0x8003 0x0000
4) 键盘和通用输入/输出引脚
下面的例子介绍了怎样使用DEMO1234.EXE程序来扫描键盘,怎样使用GPIO键盘扫描引脚。4.1) 配置键盘和GPIO引脚
GPIO控制寄存器将每个C1–C4和R1–R4引脚分别配置为输入、输出或者是键盘的一部分(请参考MAX1233/MAX1234数据资料的表26和表27)。此外,写入GPIO上拉禁止寄存器,将输出引脚配置为开漏输出。
表14. 键盘和GPIO配置实例DEMO1234 Command
Action SPI data in
T W GC FFFF
Keypad: none;
GPIO outputs: C4,C3,C2,C1,R4,R3,R2,R1;
GPIO inputs: none0x004f 0xffff
T W GC FF00
Keypad: none;
GPIO outputs: none;
GPIO inputs: C4,C3,C2,C1,R4,R3,R2,R10x004f 0xff00
T W GC 0000
Keypad: (C4,C3,C2,C1) x (R4,R3,R2,R1);
GPIO outputs: none;
GPIO inputs: none0x004f 0x0000
T W GC C8C0
Keypad: (C2,C1) x (R3,R2,R1);
GPIO outputs: C4,C3;
GPIO input: R40x004f 0xc8c0
T W GP 4000
GPIO pullup disable: C3 0x004e 0x4000
4.2) 读写GPIO引脚
GPIO数据寄存器读取GPIO输入引脚,写入GPIO输出引脚。注意:在这些例子中,C3、C4和R4是引脚名称,而不是元件名称。
表15. GPIO实例DEMO1234 Command
Action SPI data in
Verification T W GC C8C0
Keypad:
(C2,C1) x (R3,R2,R1);
GPIO outputs: C4,C3;
GPIO input: R40x004f 0xc8c0
T W GP 4000
GPIO pullup disable: C3 0x004e 0x4000
Connect external resistor between C3 pin and DVDD Connect DVM to C4 pin T W GD 8000
GPIO write C4 = 1 0x000f 0x8000
C4 pin = high T W GD 0000
GPIO write C4 = 0 0x000f 0x0000
C4 pin = low T W GD 8000
GPIO write C4 = 1 0x000f 0x8000
C4 pin = high T W GD 0000
GPIO write C4 = 0 0x000f 0x0000
C4 pin = low Connect DVM to C3 pin T W GD 4000
GPIO write C3 = 1 0x000f 0x4000
C3 pin = high T W GD 0000
GPIO write C3 = 0 0x000f 0x0000
C3 pin = low T W GD 4000
GPIO write C3 = 1 0x000f 0x4000
C3 pin = high T W GD 0000
GPIO write C3 = 0 0x000f 0x0000
C3 pin = low Connect R4 pin to DVDD T R GD
GPIO read 0x800f 0x0000
Buffer = 0x0800 Connect R4 pin to GND T R GD
GPIO read 0x800f 0x0000
Buffer = 0x0000 4.3) 检测按键:自动扫描
可以配置键盘控制寄存器在探测到有按键按下时,自动扫描键盘。
表16. 按键命令序列:自动扫描DEMO1234 Command
Action SPI data in
Verification Optional: connect oscilloscope to KEYIRQ-bar TD> I C 0 3
Configure KEYIRQ-bar pulse accumulator: falling-edge trigger I 0 0
Reset the pulse accumulator I R 0
Read the number of times KEYIRQ-bar has pulsed low count = 0 T W GC 0000
Keypad:
(C4,C3,C2,C1) x (R4,R3,R2,R1);
GPIO outputs: none;
GPIO inputs: none0x004f 0x0000
T W KC bf00
Wait for keypress;
maximum debounce and hold times0x0041 0xbf00
Press and release R1C1 (key "1") KEYIRQ pulse I R 0
Read the number of times KEYIRQ-bar has pulsed low count has increased T R KB
Read raw keypad result 0x8004 0x0000
0x0001 = R1C1 key Press and release R2C2 (key "5") KEYIRQ pulse I R 0
Read the number of times KEYIRQ-bar has pulsed low count has increased T R KB
Read raw keypad result 0x8004 0x0000
0x0020 = R2C2 key Press and release R3C2 (key "8") KEYIRQ pulse I R 0
Read the number of times KEYIRQ-bar has pulsed low count has increased
- 声学脉冲波辨识触摸屏控制技术(09-16)
- 电容式触摸屏系统解决方案(01-19)
- 触摸屏设计日益简化(03-03)
- 将系统的阻性触摸屏更新到多点触摸屏(10-22)
- 基于嵌入式技术的智能仪器触摸屏接口设计(03-02)
- 如何解决触摸屏的电磁干扰问题(03-01)