I cant find COG #1
TC
Posts: 1,019
Hello all,
I was just playing around and trying to get an idea what COG could be doing what for my reflow oven. Well I seem to be missing COG #1, and I dont know why. I am thinking there should only be 4 COGs being used (0 to 3). I have included the all the code I am using, maybe someone could tell me where it is hiding? And so I can get a better idea on what to look for. I also included a pic of what I am seeing on my display.
Line 1, is the current COG number
Line 2, is the Serial Driver COG for my display
Line 3, is 1 of 2 heater drivers COG
Line 4, is 2 of 2 heater drivers COG
Thanks
TC
I was just playing around and trying to get an idea what COG could be doing what for my reflow oven. Well I seem to be missing COG #1, and I dont know why. I am thinking there should only be 4 COGs being used (0 to 3). I have included the all the code I am using, maybe someone could tell me where it is hiding? And so I can get a better idea on what to look for. I also included a pic of what I am seeing on my display.
Line 1, is the current COG number
Line 2, is the Serial Driver COG for my display
Line 3, is 1 of 2 heater drivers COG
Line 4, is 2 of 2 heater drivers COG
Thanks
TC
Comments
The real example I can think of is with David Hein's pfth Forth. The Propeller has the Spin loader use the first cog (which is Cog 0) and then, the Forth interpreter is loaded into (Cog 1, which shows up as #1 with Cog ID ).
You can actually play around with starting and stopping Cogs in real time with Forth. That may help clarify what is going on.
Having the Block Diagram label cogs from 0 through 7, and the COGID replying in the same way is helpful. But some are not aware that Cog 0 is used to boot the Propeller (or forget) and then abandoned.
I thought cog 1 was used for a math routine then 2-7 for user programs. But I have no idea why I thought that. Can someone confirm I am wrong?
For the "-1" technique, I thought on query of cogs I was getting cog 0 as main, so I'm not sure how -1 works for cog 0.
Thanks.
Yes indeed, you are confused in several ways.
A. Any cog can be started and used for any purpose, unless the application itself dictates a special scheme.
B. The numbering of cogs started out at 0 through 7, but some clever programmers dislike this and have shifted the numbering to 1 through 8 in their specific applications.
C. Cog 0 is used to load the EEPROM binary into the Propeller which can eventually get back to Cog 0 and start the Cog 0 for other uses.
My own experience was that I couldn't fully grasp starting and stopping multiple cogs until I actually had Forth, which is interactive, to play with.
PropForth starts with Cog7 being the interactive cog; pfth Forth starts with Cog1 begin the interactive cog; and I don't know which cog Tackyon Forth starts with. But all can reach the other cogs and used them in different ways.
It is just not as easy to see in Spin or PASM how starting and stopping cogs can be useful. And yet, this is where the Propeller can become extremely powerful. You may have a few cogs that must be in infinite loops at all times to facilitate communications or sensor monitoring, but other cogs can start and stop as tasks defined by the sensors and the communications dictate.
The -1 technique is to be used with those programs from OBEX that shift the cog numbering from 0 through 7 to 1 through 8 when reporting to the user or the outside world. Not all programs require this.