STM32103ZET6 prototyping board comes with LCD having touch screen capability. It is a great way to interact with device. Practically speaking Touch screen is a resistive film that can be read as regular potentiometer which value depends on touch point. Depending on voltage drop it is possible to calculate the coordinates. To make things easy normally there are touch screen controllers used that takes most of hard work – they have internal ADC that measure the voltage and sends value to microcontroller using a selected interface (I2C or SPI). In our board there is a popular ADS7843 controller used, which talks to microcontroller using SPI. After playing around I’ve put a messy code that reads touch screen coordinates. It is a glued code from various sources, so it is only to fix some results.

Currently code reads a bunch of values, then averages to get rid of most garbage and then calculates screen matching coordinates. This is a trickiest part to do. You can do this empirically by getting min and max ADC values for each axis and then calculate coordinates using formula: (more…)


