Help with my first code using multi cogs. I am a super begginer
ELJEQUE
Posts: 1
Hi buddies.
I am from Mexico and never I programmed propeller´s chip. It is not common propeller in mexico but I have worked with Pic18f
I have read about the spin code and I have the following code but it doesnt work . I want to do the led blinking wit diferents cogs in diferents pins. I do not what I doing bad.
PS:: I using the Gear debugger and also the propeller tool.
PS2: sorry for my poor english , I am not good.
I am from Mexico and never I programmed propeller´s chip. It is not common propeller in mexico but I have worked with Pic18f
I have read about the spin code and I have the following code but it doesnt work . I want to do the led blinking wit diferents cogs in diferents pins. I do not what I doing bad.
con_xinfreq=20_000_000 _clkmode= xtal1+pll4x VAR long cog1Stack[120] long cog2Stack[120] long cog3Stack[120] long cog4Stack[120] long cog5Stack[120] long cog6Stack[120] long cog7Stack[120] PUB HUB coginit(1,nucleo1,@cog1Stack) coginit(2,nucleo2,@cog2Stack) coginit(3,nucleo3,@cog3Stack) coginit(4,nucleo4,@cog4Stack) coginit(5,nucleo5,@cog5Stack) coginit(6,nucleo6,@cog6Stack) coginit(7,nucleo7,@cog7Stack) PUB nucleo1 dira[14]~~ repeat !outa[14] waitcnt(3_000_000 + cnt) PUB nucleo2 dira[15]~~ repeat !outa[15] waitcnt(3_000_000 + cnt) PUB nucleo3 dira[16]~~ repeat !outa[16] waitcnt(3_000_000 + cnt) PUB nucleo4 dira[17]~~ repeat !outa[17] waitcnt(3_000_000 + cnt) PUB nucleo5 dira[18]~~ repeat !outa[18] waitcnt(3_000_000 + cnt) PUB nucleo6 dira[19]~~ repeat !outa[19] waitcnt(3_000_000 + cnt) PUB nucleo7 dira[20]~~ repeat !outa[20] waitcnt(3_000_000 + cnt)
PS:: I using the Gear debugger and also the propeller tool.
PS2: sorry for my poor english , I am not good.
Comments
Problem 1:
Your CON block clock setup needs a carriage return. Try this (if you are using a 20 MHz crystal):
CON
_clkmode = XTAL1+PLL4X
_xinfreq = 20_000_000
Problem 2:
Look at your repeat code. The !outa and waitcount lines should be indented underneath repeat, to be part of the loop:
The little blue lines make it easier to read blocks. You can turn them on and off with CTRL+i.
https://beta.www.parallax.com/downloads/spanish-translations-espanol