I've got a program which reads data from the serial port of a machine then manipulates it and displays data on the TFT screen, this all works fine.
In test mode the program only polls the serial port of the machine when you press a button on the touch screen. The serial port read routine has to have a short delay of 200ms from the send query to pick up response.
When I set it to auto mode the mikromedia board is automatically polling the serial port of the machine every few seconds. The display works fine but the touch screen is almost unusable as the processor is only checking for touch input once every few seconds. So you have to touch and hold the display for a few seconds before it detects your touch input.
Is there a way to generate an interrupt on touch so that the processor jumps to the code that detects and acts on the touch input instantly as soon as someone touches the display? This would make the user feel like the processor was responding immediately.
Apologies if this doesn't sound very clear. I've spent the past 2 evenings looking on the web for some help on how to do this!
Mikromedia Touch Screen Response Time Issue
- darko.minic
- Posts: 747
- Joined: 01 Dec 2014 11:10
Re: Mikromedia Touch Screen Response Time Issue
Hello,
Did you tried your mikroMedia with our examples? Did the same problem occurs?
You should examine your code so you can be able to see which particular routine makes slow response on Touch Panel.
Regards,
Darko
Did you tried your mikroMedia with our examples? Did the same problem occurs?
You should examine your code so you can be able to see which particular routine makes slow response on Touch Panel.
Regards,
Darko
Re: Mikromedia Touch Screen Response Time Issue
The touch panel works fine with the example code and with my program in test mode.
The normal sequence of operation for my program is as follows:
Start Loop:
Check Touch Screen For Touch Input
Poll Serial Port 200ms
Update Values On Display Based on Serial Port output
End Loop
The issue is that the touch screen is only checking for user input once every 200ms approx so it doens't respond to the user touch straight away.
I want it to run as follows:
Main
Start Loop:
Poll Serial Port
Update Values On Display Based on Serial Port output
End Loop
IF Touch screen is touched interrupt fires and acts on user touch input.
End
Let me know if that makes sense. I can post some code but I don't think it helps with my query.
The normal sequence of operation for my program is as follows:
Start Loop:
Check Touch Screen For Touch Input
Poll Serial Port 200ms
Update Values On Display Based on Serial Port output
End Loop
The issue is that the touch screen is only checking for user input once every 200ms approx so it doens't respond to the user touch straight away.
I want it to run as follows:
Main
Start Loop:
Poll Serial Port
Update Values On Display Based on Serial Port output
End Loop
IF Touch screen is touched interrupt fires and acts on user touch input.
End
Let me know if that makes sense. I can post some code but I don't think it helps with my query.
- darko.minic
- Posts: 747
- Joined: 01 Dec 2014 11:10
Re: Mikromedia Touch Screen Response Time Issue
Hello,
Can you please post some zipped project which represents the problem?
Regards,
Darko
Can you please post some zipped project which represents the problem?
Regards,
Darko
Re: Mikromedia Touch Screen Response Time Issue
Hi Guinness,
The touch panels use the MCU ADC channels to read for input and require them to be polled for this and can not generate a Hardware interrupt sorry to say.
It is a limitation the mikromedia devices will have.
The PICs can only have an external trigger for interrupt on certain port pins (usually PORT B pins) and the touch panel does not connect to them and operate in the proper manner (digital) anyway.
The only way to resolve this issue would be to have the touch panel polled more often and/or have the other HW generate the interrupt for attention instead (if possible).
Hope this helps, Robert.
The touch panels use the MCU ADC channels to read for input and require them to be polled for this and can not generate a Hardware interrupt sorry to say.
It is a limitation the mikromedia devices will have.
The PICs can only have an external trigger for interrupt on certain port pins (usually PORT B pins) and the touch panel does not connect to them and operate in the proper manner (digital) anyway.
The only way to resolve this issue would be to have the touch panel polled more often and/or have the other HW generate the interrupt for attention instead (if possible).
Hope this helps, Robert.
HW: easyPIC5|PICFlash2|easyBT|smartGSM|easyGSM|PICPLC16|mmWorkStation|FT800 Eve|PIC Clicker/2|
MMBs:PIC18F,PIC33EP,PIC32|CLICKs:DAC,ADC,GPS L10,Thermo,8x8B LED,Stepper,W/B OLED,9DOF,GPS3,tRF,Hall I|
SW: mP for PIC|mB for PIC-dsPIC-PIC32|Visual-TFT|
MMBs:PIC18F,PIC33EP,PIC32|CLICKs:DAC,ADC,GPS L10,Thermo,8x8B LED,Stepper,W/B OLED,9DOF,GPS3,tRF,Hall I|
SW: mP for PIC|mB for PIC-dsPIC-PIC32|Visual-TFT|
Re: Mikromedia Touch Screen Response Time Issue
Hi, thanks for the input Megahurts, I've come up with a solution to this problem if anyone else has it:
I created a delay loop which includes the Check_TP, you also need to add 2 lines of code to the Check_TP sub routine (then add them each time you use Visual TFT as it will delete them!)
The below basically interupts the rest of the program while the user is interacting with the display, it may not be suitable for all applications but it works fine for what I'm doing, which is polling a modbus device then formatting and displaying data, the user only needs to touch the panel to mute alarms and set the device up.
Part 1:
ADD This code to the top of the page where your CHECK_TP routine lives:
dim COMMCHECKBYTE as byte external 'or whatever you name your variable
dim SETUPMODEVAR as word external 'or whatever you name your variable
(ADD this code to the CHECK_TP routine just under: if (TP_TFT_Press_Detect()) then
COMMCHECKBYTE = 0 'this is for resetting my comms lost alarms while the screen is being touched
SETUPMODEVAR = 0 ' this the counter variable for pausing the program while the user touch's the screen
Part 2:
while TRUE
Check_TP() 'each pass of the delay loop checks for the touch screen being pressed, this stops the delay/lag on the touch screen I was having
SETUPMODEVAR = SETUPMODEVAR + 1 'variable for setting touch screen into user/setup mode
Delay_ms(1) '1ms delay looped 4000 times
If SETUPMODEVAR > 4000 then 'my program pauses the execution of the normal program so the screen doesn't keep refreshing while someone is trying to go through the menus etc
NORMALMODE() 'my main program that polls the modbus device, refresh's the screen every 5 seconds and alarms if there is a problem
end if
wend
Also if you use any delay loops in your main program, don't use the Delay_MS() dellay loop. Use the one below. This creates a small bug as the touch screen will flicker about after the first press but I think I can live with it.
sub procedure delaytouch() 'autoset to 500ms
rbdelayvar1 = 500 'variable for delay length
while rbdelayvar1 > 0
rbdelayvar1 = rbdelayvar1 - 1
delay_ms(1)
Check_tp()
wend
end sub
I created a delay loop which includes the Check_TP, you also need to add 2 lines of code to the Check_TP sub routine (then add them each time you use Visual TFT as it will delete them!)
The below basically interupts the rest of the program while the user is interacting with the display, it may not be suitable for all applications but it works fine for what I'm doing, which is polling a modbus device then formatting and displaying data, the user only needs to touch the panel to mute alarms and set the device up.
Part 1:
ADD This code to the top of the page where your CHECK_TP routine lives:
dim COMMCHECKBYTE as byte external 'or whatever you name your variable
dim SETUPMODEVAR as word external 'or whatever you name your variable
(ADD this code to the CHECK_TP routine just under: if (TP_TFT_Press_Detect()) then
COMMCHECKBYTE = 0 'this is for resetting my comms lost alarms while the screen is being touched
SETUPMODEVAR = 0 ' this the counter variable for pausing the program while the user touch's the screen
Part 2:
while TRUE
Check_TP() 'each pass of the delay loop checks for the touch screen being pressed, this stops the delay/lag on the touch screen I was having
SETUPMODEVAR = SETUPMODEVAR + 1 'variable for setting touch screen into user/setup mode
Delay_ms(1) '1ms delay looped 4000 times
If SETUPMODEVAR > 4000 then 'my program pauses the execution of the normal program so the screen doesn't keep refreshing while someone is trying to go through the menus etc
NORMALMODE() 'my main program that polls the modbus device, refresh's the screen every 5 seconds and alarms if there is a problem
end if
wend
Also if you use any delay loops in your main program, don't use the Delay_MS() dellay loop. Use the one below. This creates a small bug as the touch screen will flicker about after the first press but I think I can live with it.
sub procedure delaytouch() 'autoset to 500ms
rbdelayvar1 = 500 'variable for delay length
while rbdelayvar1 > 0
rbdelayvar1 = rbdelayvar1 - 1
delay_ms(1)
Check_tp()
wend
end sub