GreenLeader
Senior Member
Hi everyone, I hope you might be able to clear this up for me:
I am trying to reset a timer in my code but it refuses to cooperate.
If I use toflag=0 it does not work in the PE simulator or in hardware.
If I use settimer=value it works in the simulator but not in the hardware.
My code is below.
I am using a 40X1, running at 8MHz on internal clock.
What am I missing?
I am trying to reset a timer in my code but it refuses to cooperate.
If I use toflag=0 it does not work in the PE simulator or in hardware.
If I use settimer=value it works in the simulator but not in the hardware.
My code is below.
I am using a 40X1, running at 8MHz on internal clock.
What am I missing?
Code:
#PICAXE 40X1
setfreq m8
hsersetup B115200_8, %10
settimer 34285 'set timer for 1s increments @ 8MHz
for w0 = 0 to 100
hserout 0,("count=",#w0," timer=",#timer,"s",CR,LF) 'Line 3
pause 2000 '=1s pause at 8MHz
w1 = w0//5 'every 5th count reset timer
if w1 = 0 then 'reset timer using either settimer or toflag
'settimer 34285 'set timer for 1s increments
toflag = 0
hserout 0,("timer reset",CR,LF) 'Line 3
endif
next