Shop OBEX P1 Docs P2 Docs Learn Events
Cog Master Slave Synchronizing System Question — Parallax Forums

Cog Master Slave Synchronizing System Question

Andy_ouhscAndy_ouhsc Posts: 17
edited 2011-07-19 18:26 in Propeller 1
Hello,
I have four sensors and I want to use different cogs so that each cog will control one sensor.
I wish to use the master slave cog systems to synchronize my signals.

Can anyone provide me an example master/slave synchronizing code? It will be a great start for understanding this.

Thanks!

Andy

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-07-19 07:52
    What do you mean by "master slave synchronizing"? Be specific in describing what you want to do. What does the master do? Are you synchronizing relative to time or what?

    With the Propeller, it's usually the case that you want to synchronize with regards to time so sensors are all read at the same time. That can be easily done using WAITCNT (see the Propeller Manual for details of how that works). Sometimes the time doesn't matter, just that each cog has to wait for another cog to do its thing. The LOCKxxx instructions/Spin statements can be used for this. Sometimes you can just use a bit to signal from the master cog to the slaves that they can proceed. It all depends on what you're trying to do.
  • JonnyMacJonnyMac Posts: 9,208
    edited 2011-07-19 09:50
    You should be able to create objects for each sensor. These *could* wait for a sync signal that could be a pin state change or a specific value in a hub variable -- that's up to you. Or, you could simply round-robin call each method for its sensor data on a schedule basis from your master cog.
  • desikodesiko Posts: 18
    edited 2011-07-19 18:26
    Hi, Andy,

    Take a look at the thread below. While not exactly what you are looking for it contains much
    good stuff. Again, a great help to me when I began building my system (six slave props
    controlled by one master connected to Labview by serial port). My props are controlling
    fast D2A converters for DDS. In the end I used a 10mhz master oscillator as the clock source
    for all props.

    http://forums.parallax.com/showthread.php?124343-Parallax-Propeller-Programs-Propellers-in-ParallelV1.0-Tribute-to-the-BigBoy-4

    Regards,

    Desiko
Sign In or Register to comment.