|
Forum Index : Microcontroller and PC projects : Missing Touch response
| Author | Message | ||||
| KeepIS Guru Joined: 13/10/2014 Location: AustraliaPosts: 1945 |
I searched and didn't really find an answer. If I gently touch the screen the beeper beeps in response but no REF values is returned, the Pendown ISR does not fire, if I press a little harder then the beeper beeps AND it fires Pendown. Not using the Pendown ISR and just polling for TOUCH(REF) is exactly the same. So it appears that the hardware and some part of MMBasic is responding to the light touch (the beeper beeps) but not the code that returns the value to the user. Micromite plus, CPU 120, and version 5.04.09 of MMBasic. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
| Azure Guru Joined: 09/11/2017 Location: AustraliaPosts: 446 |
What MM+ board are you using? If the beeper (piezo) is not part of the board layout how have you connected it and what option settings are you using? |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
Interesting. Both the beeper and the interrupt are set in the same piece of code, so you cannot have one and not the other. But, the interrupt is only acted upon at the end of the currently executing command so it could be that the touch is so brief that by the time the interpreter is ready to act on the interrupt the touch has vanished. It does not sound probable but it is the only thing that I can think of. Geoff Graham - http://geoffg.net |
||||
| KeepIS Guru Joined: 13/10/2014 Location: AustraliaPosts: 1945 |
Hi Geoff, that sounds like it, touch and beeper are working perfectly in every way, been programming these for years, and this one has been running a complex multi page GUI with Charts and remote RF coms. That behaviour has always been there, if I don't press the screen with a tiny bit of pressure. You can see the button GUI depress but no code returned, press it a bit harder and it's fine all day long, it's not confined to any part of the screen, I have swapped screens and both 5" and 7", it's not a screen thing nor incorrect settings nor any reserved pins. I'll be building two more Boards soon but seriously I doubt it's a build fault. Beeper is on the board. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
| Malibu Senior Member Joined: 07/07/2018 Location: AustraliaPosts: 260 |
That sounds similar to something I found a few days ago when I was first fiddling around with the screen. I couldn't catch ALL the screen touches (it seemed to miss light and/or fast taps) It turned out it looked like it was catching ALL of the taps, but some came up as X or Y being -1 Here's the code I finished up with... dim ScreenPos as string 'Variable for screen display dim xPos, yPos, WritePos as integer 'Screen position variables setpin 15, intl, TouchInt 'Set the screen interrupt cls 'clear whatever was on the screen text mm.hres/2, mm.vres/2, "Touch me!", CM, ,2 'Ooh yeah, touch me Baby! do:loop 'Yadda, yadda... sub TouchInt ' Here's the interrupt entry xPos = touch(x) 'Get the X touch position yPos = touch(y) 'Get the Y touch position if xPos = -1 or yPos = -1 then goto AllDone 'Is there an error in the X/Y read? Finish up ScreenPos = "Touched @ " + str$(xPos) + " " + str$(yPos) 'All good, so assemble the message to put on the screen cls 'Clear the last message from the screen line xPos-20,yPos,xPos+20,yPos,1,RGB(green) 'Draw part 1 of target line line xPos,yPos-20,xPos,yPos+20,1,RGB(green) 'Draw part 2 of target line circle xPos,yPos,10,1,,RGB(green) 'Draw circle of target select case yPos 'Determine where to write the text case < (mm.vres/2) 'Touched in the upper half? WritePos = (mm.vres/4)* 3 'Write the text below the center line case else 'otherwise WritePos = mm.vres/4 'write it above the center line end select text mm.hres/2, WritePos, ScreenPos, CM, ,1 'Show a touch occured and where it happened AllDone: 'Finish up end sub Depending on how your treating the X/Y coordinates, it might be a problem with neg numbers... Hope it helps John John |
||||
| KeepIS Guru Joined: 13/10/2014 Location: AustraliaPosts: 1945 |
Thanks, yes my problem is a simple one: User (including me) hears a beep when a key is pressed - say on a key pad, only to look at the screen after a few key presses to see that some of the entered numbers are missing - NO not pressing different keys fast in succession, just some pressed were to lightly, it's hearing a confirmation beep on very light touches that's annoying is all. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
I have now tested this on several LCDs with no problems whatsoever. Also, I have checked through the MMBasic source and it is just not feasible for it to make the beep and do nothing else - no matter how soft you touch. My bet is that you have a hardware issue, not a software bug. Geoff Graham - http://geoffg.net |
||||
| KeepIS Guru Joined: 13/10/2014 Location: AustraliaPosts: 1945 |
Hi Geoff, the problem I had was the Touch interrupt causing read errors, any interrupt causes a slight variation in a high speed synchronous Clock that I'm generating for decoding two 48 bit data streams. So I tried polling for the Touch Reference, although the internal MM touch interrupt still runs and had some effect, this appeared to be my issue (polling). I relented and set the Touch-Down and Touch-UP code interrupts to do nothing but set a flag for each and grab the Key-value - grabbing the Key value this way solved the touch problem. Those UP / Down ISR flags tell the Current synchronous Clock / Read cycle to Abort and restart, this has solved my interrupt glitch problems, I was initially looking for a way to disable internal MM.Basic generated interrupts but believe this is not possible. Anyway, my touch response is back to normal. BTW The device that is clocking data out data via the Sync clock I'm generating is very "very" sensitive to any change in duty cycle or timing variations, it's just a pain but it is what it is, all good now. Apology if I wasted your time. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |