![]() |
Forum Index : Microcontroller and PC projects : Question about Touch
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1875 |
Ok, then you must have something incorrectly set in the touch screen configuration. BTW ctrlval(99) is not defined in that code snip. Mike. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1875 |
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. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
lew247![]() Guru ![]() Joined: 23/12/2015 Location: United KingdomPosts: 1702 |
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: AustraliaPosts: 1875 |
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: AustraliaPosts: 1875 |
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 KingdomPosts: 1702 |
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 KingdomPosts: 1702 |
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: AustraliaPosts: 1875 |
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. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
lew247![]() Guru ![]() Joined: 23/12/2015 Location: United KingdomPosts: 1702 |
What version of MM basic are you using? it's definitely not working on mine and the touch was calibrated correctly |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1875 |
Latest Version 5.0405. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1875 |
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 KingdomPosts: 1702 |
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: AustraliaPosts: 1875 |
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. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1875 |
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. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
lew247![]() Guru ![]() Joined: 23/12/2015 Location: United KingdomPosts: 1702 |
It does nothing maybe I need to reflash? |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1875 |
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 KingdomPosts: 1702 |
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 KingdomPosts: 1702 |
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: AustraliaPosts: 1875 |
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. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9594 |
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! |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |