Shop OBEX P1 Docs P2 Docs Learn Events
possible inter-cog comms method — Parallax Forums

possible inter-cog comms method

Graham StablerGraham Stabler Posts: 2,507
edited 2006-10-18 02:06 in Propeller 1
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

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-10-17 21:57
    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 StablerGraham Stabler Posts: 2,507
    edited 2006-10-17 22:10
    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 GreenMike Green Posts: 23,101
    edited 2006-10-17 22:24
    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.Phillip Y. Posts: 62
    edited 2006-10-17 23:09
    If port B existed you could use it. ie a virtual port.
  • Joel RosenzweigJoel Rosenzweig Posts: 52
    edited 2006-10-18 01:55
    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 HebelMartin Hebel Posts: 1,239
    edited 2006-10-18 02:02
    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
    StampPlot - Graphical Data Acquisition and Control
    AppBee - XBee ZigBee / IEEE 802.15.4 Adapters & Devices
  • Joel RosenzweigJoel Rosenzweig Posts: 52
    edited 2006-10-18 02:03
    Thanks Martin! That makes sense. Glad to learn this.

    Joel-
  • James LongJames Long Posts: 1,181
    edited 2006-10-18 02:03
    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 RosenzweigJoel Rosenzweig Posts: 52
    edited 2006-10-18 02:06
    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-
    ·
Sign In or Register to comment.