View Full Version : Putting it all together ...or... The 9th Cog

11-24-2010, 05:47 PM
I am not even sure How to ask/phrase this question.
No doubt this is "Child's Play" to most of the Forum Member's,
However, for Me, not so much..

What should I be looking for, when I want to put all of this together all at once?
What I mean is, what do I need to learn to do all these things at once?

ir[2] : "Ir Detector" 'left and Right Ir Detectors.
s : "Servos" 'Left and Right Drive Servo's
pid[2] : "PID" 'Proportional Steering Control
bumper : "ShiftRegisterObject" '74HC165 for Front Bumper
shift : "74HC595_MultiPWM" '74HC595 for Running Boards and Compass Lighting
HMC6352 : "HMC6352" 'Compass Module
led [2] : "jm_bicolor" 'Bicolor Led's

I can make any of the objects work alone, or even 3 or 4 of them at once,
but to have all of them function at once, is where My troubles be..

I obviously know enough to be dangerous, as in I have allready built the circuits in question.
I know I am running out of Cogs, with just what is in that OBJ section.
But, how do I get more Cogs?... lol

I know that there be many a COGSTOP in My future. More importantly though,
The timing of all these objects will need the most attention, and I guess that is
What My Question really is..(now that I typed it out...)

Anyways, I think My Question is "what should I focus on to learn more?"

Sigh... that sounds lame... Well, maybe some input from the forum will help to Rephrase My Question better.

Thank You for reading this.. and please be patient with the newbie.:lol:

11-24-2010, 06:28 PM
First, you need to understand that objects are not cogs. A single object may require multiple cogs, or may run in the cog used by the calling/parent object. You need to look at the documentation (or source code) for each object.

But, given that you have 10 objects, and there's a good chance each object contains a PASM driver and thus consumes a cog, what next? Well, there's a slight chance someone else has had similar problems and has created an object which does more with a single cog - like an enhanced jm_bicolor which drives two LEDs.

Another possibility is to see if there's a way you could pull the function into your main object so it doesn't require a dedicated cog.

If those options don't pan out, you can try to create your own objects which either combine functions or handle left & right in the same cog. Objects which poll or are counter based can often be combined successfully by alternating functions.

A final option is to simply add a second Propeller.

11-24-2010, 08:05 PM
YES! this is the Question, THANK YOU, THANK YOU...

But, given that you have 10 objects, and there's a good chance each object contains a PASM driver and thus consumes a cog, what next?

OBJects are not Cog's, but, OBJects need Cogs, this I do know,
Three of the OBJ's in that list do require [2] each..
(at least for now.)

10 OBJ's is a bit of an understatement.
I didn't want to sound greedy, So I did not mention the XBee, or the CD4028...:smilewinkgrin:

11-24-2010, 10:20 PM
My bicolor LED code (jm_bicolor) is pretty straightforward and you should be able to create a single-cog version that runs two or more LEDs.

11-25-2010, 02:23 AM
I find I always run out of cogs.

But many of the things you want to do are fairly simple, and won't take up the full 2k of a cog. So maybe you can look at learning some PASM, and try to combine some of the pasm code you have into one cog.

Cluso showed me how to do this with a ram chip driver, where you pass simple one letter commands to the driver, and then it runs the appropriate bit of code. eg N to turn a led on, F to turn it off.

11-25-2010, 03:01 AM
Looks to me that it's time to go shopping....in the Obex.

I know there is a object in there that can handle more than 2 servos in 1 cog.

11-25-2010, 05:44 PM
Thank You.