How to use touch func in 2.8" tft lcd resistive breakout display

I am workng with sifive-Hifive1 micro controller (Arduino compatible), i ve got 2.8" tft lcd resistive breakout display

Now my question is to access the touch function what should i do?
Constraints: My micro controller does not have analog header pins

i thought to use ADC so i bought MCP3008

I took TouchScreen library and made some changes in the code to support my Hifive1 (in C language) and compiled it in my terminal using risc-v compiler.
The problem is with the connections as in the actual touchscreen library it sets the digitalWrite()/pinMode() to analog pins also. So i had to give this following pin connections

Y+ HiFive pin6 and MCP3008 Chan 1
Y- HiFive pin7
X+ HiFive pin9
X- HiFive pin8 and MCP3008 Chan 0

but i dont know where the problem is! i have taken breakout_touchPaint as an example code , when i place my finger on the screen it prints somewhere else.

How to fix this issue?

is it advisable to go with ADC ? or shall i try resistive touchscreen controller like STMPE610 ?

i will attach my code also.

touchScreen.c (13.5 KB)

If Adafruit recommend STMPE610 it would be the easiest route.
Or there might be breakout boards for XPT2046 or AD7846

Yes, you could use an external ADC but it gets complicated when you want to read a resistive display. It involves changing pins from Analog Input to Digital Output and back again.

The real mystery is "HiFive". There are plenty of microcontroller boards with Arduino pinout and Arduino core e.g. STM32 Nucleo or ESP32.
The whole philosophy behind "microcontroller" is to produce single-chip solutions for "common peripherals" e.g. ADC, DAC, USART, RTC, ...
Adding external chips is the last resort.


Thanks for your guidance, our aim is actually to study Hifive1 MCU by developing many applications with this MCU
that is the reason why we have chosen this micro controller.

Buy an STMPE610 breakout. Job done.

Are you using 8080-8 or SPI interface?

There are plenty of 3.3V SPI displays that come with XPT2046 Touch Controller and SD card. This means everything runs on SPI with a few extra pins for TFT_CS, TFT_RS, TFT_RST, Touch_CS, Touch_IRQ, SD_CS etc


I am using SPI interface.
I have ordered STMPE610.

Yes, i have seen some of them from , but i purchased this adafruit tft lcd display a bit earlier.
later i found that these kind of displays what you said are also available in the market.