-
For ... Next
i want to print numbres from 0 to 10 and display it on LCD as below
I var byte
main
i=0
for i=0 to 10
serout 2,2,[#I]
next I
goto main
but i note the first number will be 1 not 0, i tried to change idea as below
I var byte
Z var byte
main
z=0
for i=0 to 10
serout 2,2,[#z]
z=z+1
next I
goto main
but the problem still exist
any idea to solve that ?
-
Try this:
i var byte
main
for i=0 to 10
serout 2,2,[DEC i]
next i
goto main
-
Also try this.
-----------------
i var byte
Main:
i=0
While i<11
serout 2,2,[#i]
i=i+1
wend
goto main
-------------------------
That is gonna be so fast.
-------------
-
micro,
Your first command to print the 0 might be missed if you are not “idling high”.
Add the following line
PORTB.2 =1
somewhere before your first SEROUT statement and all should be well with your original code. This line will cause pin 2 to idle high, which is required for T9600. Let us know how it turns out.
Oh, you also should add a ":" to your first main so that it looks like main:
Good Luck,
Paul Borgmeier
Salt Lake City, Utah
USA