How to implement LCD capacitive touch screen
There are two types of touch technologies, resistive and capacitive touch that are widely used in nowadays TFT touch screen. We have a post of “how to implement LCD display resistive touch function”. Here, we are showing an example of setting up and testing the hardware interface to capacitive touch LCD panel.
Application's Hardware
- Tango C48 is used to drive a Topway 5 inch capacitive TFT LCD touch screen
- STM32F103VCT6 is the host MCU
Tango C45's pins are connected with STM32 MCU GPIOs like below:
Tango C48 | STM32 | Remarks |
---|---|---|
RST | PA11 | Rest |
SDA* | PA1 | IIC data |
SCL* | PA2 | IIC clock |
ATTB | PA3 | Interrupt |
* A pull-up resistor of 2.2K is needed.
IIC Timing Diagram
Tango C48 write sequence
Tango C48 read sequence
- MCU sends start signal S, sends write address: 0XB8(Address_W) 1*
- MCU waits for Tango's ACK signal, MCU sends read/write register address
- In read mode, MCU issues start signal S again, sends read address: 0XB9(Address_R) 1*
- Read/Write data from/to selected register
- Read/Write finished, MCU sends stop signal N
1* Tango C48 address format: 7 bits address + read/write bit
Read: (0X5C<<1)|0X00
Write: (0X5C<<1)|0X01
See attachment for sample code.
Summary
- On Tango C48 initialization, need to set aside registers for power, interrupt mode, interrupt length
- Try to use less interruption, instead set up flag to convey information to front end
- When using RTOS, avoid using IIC analog time sequence to read/write data. Multi-tasks processing will mess up time sequence. Using register is a better idea.