|
Forum Index : Microcontroller and PC projects : Endless loop display TFT
| Author | Message | ||||
| miyek.ard Newbie Joined: 31/03/2018 Location: MalaysiaPosts: 24 |
I have a big problem (I guess) and I don't know to solve this. I try to run some program using "XMODEM RECEIVE" command in Tera Term. However, the problem comes when I realize my program has endless loop! My TFT keep displaying page 1, 2, and 3 simultaneously nonstop. How should I end the loop? This is my third set of MM+ LCD Backpack, I would cry if I have to purchase another set OPTION AUTORUN ON PWM 2, 1000,25 ' Set LCD Backlight brightness CLS RGB(black) font 4 const pg1 = 1, pg2 = 3, pg3 = 8 gui setup 1 gui CAPTION #1, "Please Enter Password", 30,90 gui setup 2 gui CAPTION #3, "Hydrogen Generator", 15, 13 gui setup 3 gui CAPTION #8, "Setting", 105,10 do page 1 for i=0 to 10 next i page 2 for h=0 to 10 next h page 3 for j=0 to 10 next j LOOP Please help! |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
From the Micromite Manual page 16 (don't worry, a lot of people miss it): Geoff Graham - http://geoffg.net |
||||
| Azure Guru Joined: 09/11/2017 Location: AustraliaPosts: 446 |
Your "do loop" loops between the 3 pages with a small (very brief in mm time) counter loop between each screen. So the program, as it is above, is supposed to loop quickly between pages 1,2 & 3 and then start again. What is it you want it to do? You should also use the option explicit off command and then declare your variables as integer or whatever you want them to be. Currently they are being auto defined as floats. |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9750 |
EDIT: To stop your code running when it has gone mad like this, use CTRL-C. IE: Hold down the CTRL key on your keyboard, and press 'C'. That should stop the code, and return you to the command prompt. As Azure mentions, you have no delays in the FOR/NEXT loops, and they will complete very quickly(within a ms or two - if that, as they are not DOING anything), and so the pages will display one after another very quickly. Try this: OPTION AUTORUN ON PWM 2, 1000,25 ' Set LCD Backlight brightness CLS RGB(black) font 4 const pg1 = 1, pg2 = 3, pg3 = 8 gui setup 1 gui CAPTION #1, "Please Enter Password", 30,90 gui setup 2 gui CAPTION #3, "Hydrogen Generator", 15, 13 gui setup 3 gui CAPTION #8, "Setting", 105,10 do page 1 for i=0 to 10 PAUSE 500 next i page 2 for h=0 to 10 PAUSE 500 next h page 3 for j=0 to 10 PAUSE 500 next j LOOP The PAUSE 500 delays in the FOR/NEXT loops will cause the code to show page after page, but with a 5 second delay between showing the pages.(500mS x 10 = 5 seconds) Azure also has a point in that you should start using OPTION EXPLICIT(and defining all your variables) if you have not done so already. It makes debugging later much easier. ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
| miyek.ard Newbie Joined: 31/03/2018 Location: MalaysiaPosts: 24 |
This really helps, thanks! Actually I just want to test the display only as I am newbie to this MM+. I want to try 'GUI SETUP #' and 'PAGE #' command. But I forgot to consider about the delay and else. Okay will try this later! I'll update once I'm done. Thanks!! |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |