"Multi tasking" with a TFT display to control 2 motors

Hi all

I have been using an Arduino Mega 2560 and a '2.8" TFT Color LCD,touch screen shield for Arduino Mega' from nuelectronics for a few days now designing the GUI for new machine (in an attempt for cost reduction by replacing my VUnitronics ision230 PLC with an Arduino Mega and a touch TFT display). The machine recieves input from about 10 sensors and controls a brushless DC motor, a stepper motor and 3 solenoids.

My GUI is almost complete but I have a very big concern now. To control the motors, I need to exit the endless while(1) loop which "listens" for touch screen points and checks if the touch point is valid and which menu was pressed. This means that until the machine completes its cycle, I can not accept any input from my touch screen (to stop the cycle for example).

So basically my question is, is there a way to attach an interrupt to the touch screen and only respond to that interrupt instead of being stuck in an endless loop?

I know that it's possible to attach 6 interrupts to the Arduino Mega but none of them are the pins my TFT is using.


Do you have a datasheet of the touchscreen? does it provide a signal that can be connected to the Arduino Interrupt lines?

If so, an IRQ routine can read the touch screen and add the keypress in some processing queue that is processed during the infinite endless while(1) loop()

Search for attachInterrupt() for the basics about IRQ's

Hope this helps,


I couldn't find the pin out of the shield. There is a data sheet for the screen itself but I don't think it includes the touch.

I bought the TFT from nuelectronics.

Any other ideas besides interrupts?