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 : MM170 and ILI9341 Button Test...
Author | Message | ||||
Zonker Guru Joined: 18/08/2012 Location: United StatesPosts: 761 |
Evening Gents.. I was wanting to get to work on getting a Welder controller spun up for Ed Hase, a buddy of mine, and since I don't need a lot of I/O pins, decided to try out using the 28 pinner with a 2.4" SPI display.. I have worked with the 470 and the awesome built in controls but didn't have any serious play time with this type of setup... So, I just read the PDF manual, and started with Geoff's suggested test program. Unlike the 470 firmware, there isn't any "Pen_up/Pen_down" stuff, there is only the fact that you can assign an inturpt routine to call when the T_IRQ pin goes "low" on the touch controller. Ok, I get it, In a 170 there is no room for any of the "fancy" stuff like the 470, so, you just have to handle all the GUI stuff yourself, and this includes creating simple "buttons" and other objects you will need in your program. So, I started out by expanding on Geoff's to include a simple "button" object and wanted to create a "touch detector" for it. Along the way, I found out that the INT routine was trapping the touch data and reporting that sometimes either TOUCH(X) or TOUCH(Y) or both were showing as -1 in the captured data. Some simple software "filtering" removed the errors, but this test program keeps count of them. I also trap the touches that are within bounds of the "Button" drawn on the screen and count them also. Overall, it seems to be working OK... Will keep going as play time permits.. Anyway, I wanted to post it here in case anyone else might have an interest... ' test program ili9341 LCD touch display SetPin 18,intl,user_touch ' T_IRQ pin on touch controller CLS Box 0,0,MM.HRes-1,MM.VRes/2,3,RGB(red),RGB(blue) RBox 160,150,150,50,10,RGB(yellow),RGB(brown) Text 190,172,"Button",lm,1,2,RGB(yellow),RGB(brown) Do Text MM.HRes/2,MM.VRes/4,Time$,cm,1,4,RGB(cyan),RGB(blue) If A Then Circle 300,100,10,3,1,RGB(yellow),RGB(yellow) a=0 Else Circle 300,100,10,3,1,RGB(blue),RGB(blue) a=1 EndIf Pause 100 Loop Sub user_touch tx=Touch(x) ty=Touch(y) If tx>0 And ty>0 Then Text 12,140," ",lm,1,2,RGB(black),RGB(black) Text 12,140,"X "+Str$(tx,3)+" Y "+Str$(ty,3),lm,1,1,RGB(cyan),RGB(black) If tx>160 And tx<310 Then If ty>150 And ty<200 Then tc=tc+1 Text 12,160,"Button Count "+Str$(tc,3),lm,1,1,RGB(cyan),RGB(black) EndIf EndIf Else ec=ec+1 Text 12,180,"Errors Count "+Str$(ec,3),lm,1,1,RGB(cyan),RGB(black) EndIf End Sub |
||||
OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 911 |
Zonker, I too prefer the 28 pinners for small projects and would like to say how grateful I am that you are sharing your code as I am sure I will be referring to it in future exploits. Graeme |
||||
panky Guru Joined: 02/10/2012 Location: AustraliaPosts: 1098 |
Zonker, There is a post from Mike O (Font scaling bug in 5.0302) here that demos using buttons on an ILI LCD. This might give you some ideas. It works fine - you just have to be careful not to have any part of your button character extend outside the bounds of the button or it will crash the system. Cheers, Doug. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
Zonker Guru Joined: 18/08/2012 Location: United StatesPosts: 761 |
Thank's Doug..! I will take a peek at it when I get back from work today... I hope doing GUI stuff on a 170 won't be to much of a pain.. |
||||
Print this page |