lbenson
Senior Member
On a 20x2, I'm trying to roughly replicate the "time" variable usage on the M2 parts (so I can interchange some M2 and X2 code).
The following code, should, to my mind, print the count of minutes followed by 60 "."s, but I get only the number "1". It appears that toflag is not being set. What am I missing?
The following code, should, to my mind, print the count of minutes followed by 60 "."s, but I get only the number "1". It appears that toflag is not being set. What am I missing?
Code:
' 20timertick ticks one second at 16mHz
#picaxe 20X2
#Terminal 19200
symbol time=w27
symbol minutes = b1
SetFreq M16 ; for X2 picaxe
pause 8000 ' 2 seconda @ 16mHz
settimer t1s_16
toflag = 0
time=60 ' set up for first minute
sertxd("starting",cr,lf)
main:
do
if toflag = 1 then ' a second has passed on 20X2 chip
settimer t1s_16
toflag = 0
time = time + 1
sertxd(".")
endif
if time > 59 then ' every minute: at 16mHz
inc minutes
sertxd(cr,lf,#minutes," ")
time = 0
endif
loop