Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 16:16 16 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Question about Touch

     Page 2 of 3    
Author Message
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1875
Posted: 10:55pm 31 Aug 2017
Copy link to clipboard 
Print this post

Ok, then you must have something incorrectly set in the touch screen configuration.

BTW ctrlval(99) is not defined in that code snip.

Mike.Edited by KeepIS 2017-09-02
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1875
Posted: 11:01pm 31 Aug 2017
Copy link to clipboard 
Print this post

BTW There is a problem with the code.

You have to reset ctrlval to 0, ctrlval(25) = 0, after you have called test1, otherwise the condition is ALWAYS true.

Mike.Edited by KeepIS 2017-09-02
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 11:05pm 31 Aug 2017
Copy link to clipboard 
Print this post

  KeepIS said   BTW There is a problem with the code.

You have to reset ctrlval to 0, ctrlval(25) = 0, after you have called test1, otherwise the condition is ALWAYS true.

Mike.


I thought as it's a switch it always resets to 0 once you remove your finger

and ctrlval(99) is defined in that code snip. (ctrlval(99)="Forecast")
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1875
Posted: 11:09pm 31 Aug 2017
Copy link to clipboard 
Print this post

No, when it is touched it is set to 1. If another Radio button is pressed it returns to 0, it stays set to 1 in this case unless you use code to turn the button off - by setting it to 0.

NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1875
Posted: 11:11pm 31 Aug 2017
Copy link to clipboard 
Print this post

But what is the GUI Control that is set to 99?
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 11:11pm 31 Aug 2017
Copy link to clipboard 
Print this post

Touch is definitely working
If I include these 2 lines of code in the main Do/Loop it prints 1 and 0 as expected when touched

print touch(down)
print touch(up)

IF I include it in the SUB loop when the switch is touched nothing happens, the same as the switch does nothing
I'm wondering if its a problem with the switch command
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 11:13pm 31 Aug 2017
Copy link to clipboard 
Print this post

  KeepIS said   But what is the GUI Control that is set to 99?


Whoops I forgot to paste 1 line of code
GUI DISPLAYBOX #99, 550,255,190,30,RGB(BLACK),RGB(131,178,37) 'Displaybox "Forecast"
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1875
Posted: 11:15pm 31 Aug 2017
Copy link to clipboard 
Print this post

Well I just tested the code (leaving out ctrlval(99) to make sure it works as expected - It does.

The Radio button turns green and it prints out - Tomorrow touched.

Mike.

EDIT And it works with the missing GUI 99 definition included.Edited by KeepIS 2017-09-02
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 11:21pm 31 Aug 2017
Copy link to clipboard 
Print this post

What version of MM basic are you using? it's definitely not working on mine
and the touch was calibrated correctlyEdited by lew247 2017-09-02
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1875
Posted: 11:26pm 31 Aug 2017
Copy link to clipboard 
Print this post

Latest Version 5.0405.
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1875
Posted: 11:29pm 31 Aug 2017
Copy link to clipboard 
Print this post

Have you tried this standard test for X Y position with touch.


GUI INTERRUPT MyInt

DO
Loop

Sub MyInt
Print TOUCH(X) Touch(Y)
END SUB


Mike.
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 11:35pm 31 Aug 2017
Copy link to clipboard 
Print this post

  KeepIS said   Have you tried this standard test for X Y position with touch.


Option default none
Option explicit
CLS
GUI INTERRUPT MyInt
DO
Loop
Sub MyInt
Print TOUCH(X) Touch(Y)
END SUB
END



Mike.


That's weird it does nothing yet I know the screen responds to touch because it stops the clock on the normal program
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1875
Posted: 11:40pm 31 Aug 2017
Copy link to clipboard 
Print this post

OK how about the built in test command:

GUI TEST TOUCH

It basically allows you to draw on the screen.

Run from the prompt.

Mike.Edited by KeepIS 2017-09-02
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1875
Posted: 11:44pm 31 Aug 2017
Copy link to clipboard 
Print this post

Another question, why does it stop the clock? Sounds like a control pin is being shared / conflicting between the two, Touch pad and RTC perhaps?

Mike.
Edited by KeepIS 2017-09-02
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 11:46pm 31 Aug 2017
Copy link to clipboard 
Print this post

  KeepIS said   OK how about the built in test command:

GUI TEST TOUCH

It basically allows you to draw on the screen.

Run from the prompt.

Mike.


It does nothing
maybe I need to reflash?
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1875
Posted: 11:51pm 31 Aug 2017
Copy link to clipboard 
Print this post

That is the easiest, you could also try unplugging the RTC board if it's easy just for a quick test, but something strange is going on there and at least you know it's not your code
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 11:51pm 31 Aug 2017
Copy link to clipboard 
Print this post

I've just re-ran GUI CALIBRATE
deviation X = 740 Y - 49 (pixels)

that looks to me like a problem with the touch screen?
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 11:55pm 31 Aug 2017
Copy link to clipboard 
Print this post

I thought on the test it drew the touch points
top left top right bottom right bottom left?
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1875
Posted: 12:04am 01 Sep 2017
Copy link to clipboard 
Print this post

Normally it reports an error if they are way out, but yes, looks like something is not right with 720 value. Have you tried unplugging the screen and checking it fully seats when plugged back in? or could be a dry joint on either board. Also look at Touch ribbon cable on the LCD, some have a small connector on the ribbon cable.Edited by KeepIS 2017-09-02
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9594
Posted: 02:28am 01 Sep 2017
Copy link to clipboard 
Print this post

GUI CALIBRATE should result in figures that are very close to zero if the calibration is accurate. When you run GUI CALIBRATE, you are prompted to touch and hold the target. The best accuracy is had with a touch-screen pen or stylus so you can touch exactly on the cross-hairs, but failing that, a firm touch with your finger normally does it. Figures like you are getting above would make the alignment of the touch WAY off, so would explain most of your problems - this needs to be corrected before you can get anywhere useful I would think. Do you happen to have another LCD you can test with?
Smoke makes things work. When the smoke gets out, it stops!
 
     Page 2 of 3    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025