CNT Confusion / Blinking LED Stalls
biznode
Posts: 2
I must be forgetting something basic about CNT but I'm not seeing it.
Running on a PropBOE, I'd expect the following to blink the LED continuously.
Every minute or so it stalls on or off for about 10 seconds.
What am I missing?
Thanks.
-- Al
CON
_clkmode = xtal1 + pll16x '80MHz operating frequency.
_xinfreq = 5_000_000
LED_HEARTBEAT = 3
var
long HeartbeatCnt
long HeartbeatInterval
Pub Start
DIRA[LED_HEARTBEAT] := 1
OUTA[LED_HEARTBEAT] := 1
HeartbeatInterval := clkfreq / 1000 * 50
HeartbeatCnt := Cnt + HeartbeatInterval
repeat
if Cnt > HeartbeatCnt
OUTA[LED_HEARTBEAT] := ! OUTA[LED_HEARTBEAT]
HeartbeatCnt := HeartbeatCnt + HeartbeatInterval
Running on a PropBOE, I'd expect the following to blink the LED continuously.
Every minute or so it stalls on or off for about 10 seconds.
What am I missing?
Thanks.
-- Al
CON
_clkmode = xtal1 + pll16x '80MHz operating frequency.
_xinfreq = 5_000_000
LED_HEARTBEAT = 3
var
long HeartbeatCnt
long HeartbeatInterval
Pub Start
DIRA[LED_HEARTBEAT] := 1
OUTA[LED_HEARTBEAT] := 1
HeartbeatInterval := clkfreq / 1000 * 50
HeartbeatCnt := Cnt + HeartbeatInterval
repeat
if Cnt > HeartbeatCnt
OUTA[LED_HEARTBEAT] := ! OUTA[LED_HEARTBEAT]
HeartbeatCnt := HeartbeatCnt + HeartbeatInterval
Comments
Thanks for your help.
-- Al