PDA

View Full Version : possible inter-cog comms method



Graham Stabler
10-18-2006, 04:48 AM
I was thinking about implementing PID control and the like on the propeller, I was thinking about intercog communication and it struck me that you could use the counter output in one cog to drive the counter input in another. Either do DAC then ADC or can you keep it digital?

I was just thinking it was fast, had little overhead and potential for decent resolution. Not sure it is any better than just banging bits really, just a thought.

Graham

Mike Green
10-18-2006, 04:57 AM
Graham,
Once you decide to devote one or more I/O pins to inter-cog communication, really any mechanism that you would use between two Propellers would work just as well within a single Propeller. One pin could get you a half duplex asynchronous serial connection. Two could get you an I2C or full duplex serial connection (or an analog value). Three could get you an SPI connection, etc.

What you suggest with a counter in one cog driving a counter in another cog would also work. You'd have to have some scheme for deciding when to stop counting and read the resulting value. That would probably take another pin.
Mike

Graham Stabler
10-18-2006, 05:10 AM
I was thinking about how to let one asm cog share data (probably a single value) with another asm cog as fast as possible without touching the hub, if you had a basic loop and you started counting at the beginning of the loop you could tweak the timing to ensure there was enough time to capture the signal from the other cog, that part happens in the background, I'm assuming the other cog is always sending the value with say the DAC.

I think I'm probably talking rubbish, I was almost thinking along the lines of each cog acting a bit more like an analogue block rather than trying to count an exact number.

Graham

Mike Green
10-18-2006, 05:24 AM
Anything other than devoting a block of I/O pins for parallel transfers between cogs would be slower than using a HUB variable

Phillip Y.
10-18-2006, 06:09 AM
If port B existed you could use it. ie a virtual port.

Joel Rosenzweig
10-18-2006, 08:55 AM
I'm not understanding how you could write a word to some parallel IO pins faster than you could write the same word to some shared memory. How can this be faster? Isn't the basic operation still doing a memory store to a given address? That address could be the address of a piece of shared memory, or it could be the outa register.

Can you elaborate on what you meant? This sounds really interesting.

Joel-

Martin Hebel
10-18-2006, 09:02 AM
Each cog has an OUTA regsiter which can be directly accessed at anytime in assembler. Shared memory is mutually exclusive meaning it has to go though the hub. Access to shared memory is at best every 15 clock cycles, plus 7 more a complete hub operation. Access to the outa register is one cycle.

-Martin

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
Personal Links with plenty of BASIC Stamp info (http://www.isat.siu.edu/hebel/links_personal.htm)
StampPlot - Graphical Data Acquisition and Control (http://www.stampplot.com/)
AppBee - XBee ZigBee / IEEE 802.15.4 Adapters & Devices (http://www.selmaware.com/appbee)

Joel Rosenzweig
10-18-2006, 09:03 AM
Thanks Martin! That makes sense. Glad to learn this.

Joel-

James Long
10-18-2006, 09:03 AM
Joel,

Because you bypass the hub (remember the cogs all access all the pins at the same time) you can save some time. This would bypass the hubs sequential spreading of information......

James L

WOW....all typing at the same time

Joel Rosenzweig
10-18-2006, 09:06 AM
James said...
WOW....all typing at the same time

We must have all been typing to the OUTA register through our own dedicated cogs. :-)

Joel-