Hello,
when I use this code (40X1 firmware A.6, external 16 MHz crystal, prog editor 5.2.7) :
I expect the LED connected to portC 5 to flash once a second... but it doesn't flash at all, except once at the very beginning of the program (high/low).
I can't use setintflgas because I already use and need setint.
Is the toflag variable only updated (= set when timer overflows) when using setintflags ?
What I have understood about timers is that, once set with settimer, the internal variable timer will count in the background, and when it exceeds 65536, the toflag variable will be set to 1.
Could someone clarify this, please ?
I have searched for and found some other threads about timers, but most use setintflags.
What I want to do is being able to know when about 1 second has elapsed (accuracy is not very important), when going to checkTimer.
Thank you for your help,
Christophe
when I use this code (40X1 firmware A.6, external 16 MHz crystal, prog editor 5.2.7) :
Code:
#picaxe 40x1
#No_Table
#No_Data
setfreq em16
settimer t1s_16
high portc 5
pause 4000
low portc 5
main:
gosub checkTimer
pause 100
goto main
checkTimer:
if toflag = 1 then
high portc 5 : pause 1000 : low portc 5
toflag = 0
timer = 0xffff
endif
return
I can't use setintflgas because I already use and need setint.
Is the toflag variable only updated (= set when timer overflows) when using setintflags ?
What I have understood about timers is that, once set with settimer, the internal variable timer will count in the background, and when it exceeds 65536, the toflag variable will be set to 1.
Could someone clarify this, please ?
I have searched for and found some other threads about timers, but most use setintflags.
What I want to do is being able to know when about 1 second has elapsed (accuracy is not very important), when going to checkTimer.
Thank you for your help,
Christophe