mikea
04-06-2012, 12:42 PM
im not sure if im referencing the cogstop correctly. when i press the pushbutton it stops the green led. im guessing that it is stopping the cog that contains the command "cogstop" instead of the red led , the one im trying to reference.what am i doing wrong?
{Object_Title_and_Purpose}
CON
_clkmode = xtal1 + pll16x 'Standard clock mode * crystal frequency = 80 MHz
_xinfreq = 5_000_000
VAR
long stack[100]
pub main
dira[8]~~
dira[2]~
cognew (led,@stack)
repeat
!outa[8] 'flash green led
waitcnt(clkfreq/2+cnt)
if ina[2]==0 'if button is pushed stop red led
cogstop (led)
pub led
dira[9]~~
repeat
!outa[9] 'flash red led
waitcnt(clkfreq/2+cnt)
{Object_Title_and_Purpose}
CON
_clkmode = xtal1 + pll16x 'Standard clock mode * crystal frequency = 80 MHz
_xinfreq = 5_000_000
VAR
long stack[100]
pub main
dira[8]~~
dira[2]~
cognew (led,@stack)
repeat
!outa[8] 'flash green led
waitcnt(clkfreq/2+cnt)
if ina[2]==0 'if button is pushed stop red led
cogstop (led)
pub led
dira[9]~~
repeat
!outa[9] 'flash red led
waitcnt(clkfreq/2+cnt)