mikediv
01-07-2009, 04:45 AM
I was using one of the sample code examples in methods and cogs it goes somehting like this
VAR
ˇˇˇ long stack[30]
PUB LaunchBlinkCogs
ˇˇˇ coginit( 1, Blink(4, clkfreq/3, 9), @stack[0])ˇˇˇ ' Ijust initialized a cog number1
ˇˇˇ coginit(22, Blink(5, clkfreq/7, 21), @stack[10])ˇ ' I turned on cog 22 how can that be!!!!
ˇˇˇ coginit(3, Blink(6, clkfreq/11, 39), @stack[20])
PUB Blink( pin, rate, reps)
ˇˇˇ dira[pin]~~
ˇˇˇ outa[pin]~
ˇˇˇ
ˇˇˇ repeat reps * 2
ˇˇˇˇˇˇ waitcnt(rate/2 + cnt)
ˇˇˇˇˇˇ !outa[pin]
it blinks some leds I am sure you guys can figure that out by reading code. My question is
when typing I accidently put this in coginit(22, Blink(5, clkfreq/7, 21), @stack[10])ˇ 'ˇI compiled it
and the program ran just fine I then on purpose when I saw this program seemed to work added 3 more lines with
coginit(12, Blink(5, clkfreq/7, 21), @stack[10])ˇ 'ˇ downloaded it and ran the program the Leds all blinked and the program appears to run just fine
but if there are only 8 cogs how can this be?? is spin just defaulting to a know cog state,, and since my program appears to work
is there anyway to actualy see the cogs running in real time? how can I tell which cogs were actualy started if any?
VAR
ˇˇˇ long stack[30]
PUB LaunchBlinkCogs
ˇˇˇ coginit( 1, Blink(4, clkfreq/3, 9), @stack[0])ˇˇˇ ' Ijust initialized a cog number1
ˇˇˇ coginit(22, Blink(5, clkfreq/7, 21), @stack[10])ˇ ' I turned on cog 22 how can that be!!!!
ˇˇˇ coginit(3, Blink(6, clkfreq/11, 39), @stack[20])
PUB Blink( pin, rate, reps)
ˇˇˇ dira[pin]~~
ˇˇˇ outa[pin]~
ˇˇˇ
ˇˇˇ repeat reps * 2
ˇˇˇˇˇˇ waitcnt(rate/2 + cnt)
ˇˇˇˇˇˇ !outa[pin]
it blinks some leds I am sure you guys can figure that out by reading code. My question is
when typing I accidently put this in coginit(22, Blink(5, clkfreq/7, 21), @stack[10])ˇ 'ˇI compiled it
and the program ran just fine I then on purpose when I saw this program seemed to work added 3 more lines with
coginit(12, Blink(5, clkfreq/7, 21), @stack[10])ˇ 'ˇ downloaded it and ran the program the Leds all blinked and the program appears to run just fine
but if there are only 8 cogs how can this be?? is spin just defaulting to a know cog state,, and since my program appears to work
is there anyway to actualy see the cogs running in real time? how can I tell which cogs were actualy started if any?