Pages: [1]   Go Down
Author Topic: "Multi tasking" with a TFT display to control 2 motors  (Read 1167 times)
0 Members and 1 Guest are viewing this topic.
Israel
Offline Offline
Full Member
***
Karma: 0
Posts: 137
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Thanks.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 220
Posts: 13834
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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,
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Israel
Offline Offline
Full Member
***
Karma: 0
Posts: 137
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

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?

Thanks
Logged

Pages: [1]   Go Up
Jump to: