Looping 7-Digit LED Display
Electrically Challenged
Posts: 22
Oh, and recently I changed the code on my display so that I could loop it. But to be safe I thought I would ask if I can do that or will it cause issues?
I used the code from DisplayDigits.bs2, but rather than use END, I used RETURN. Is that kosher?
Thanks,
Ron
(I'm scrambling to get my micro-controller and laptop up to snuff for a bunch of scouts - I'd like them to see the code. I'm also using the DisplayDigitsWithLookup.bs2, but not looped).
I used the code from DisplayDigits.bs2, but rather than use END, I used RETURN. Is that kosher?
Thanks,
Ron
(I'm scrambling to get my micro-controller and laptop up to snuff for a bunch of scouts - I'd like them to see the code. I'm also using the DisplayDigitsWithLookup.bs2, but not looped).
Comments
You can't use a RETURN, since there is no subroutine. The easiest way is to add a label near the start and end with a GOTO to loop back (or use a DO loop).
Let's use a label with a GOTO.
Find this line (a comment in green) near the start of the program:
' BAFG.CDE
Right before that, add this new line:
main:
That's a label named "main". Not a command, just marks this location to come back to.
Now go to the end of the program. Find the next to last line:
DIRH=%00000000
Right before that, add this new line:
GOTO main
And run the program. It should loop back to main: and do the numbers again. Note that this new GOTO added prevents the final two lines (DIRH and END) from ever being run. You can delete them.
Assuming that works for you, try a DO loop. Change the main: label to a DO statement, which marks the beginning of a loop. Then change the GOTO main command to LOOP . It should work the same.