Synchronizing flashing LEDs and RTCs

Discussion in 'Programmer's Corner' started by atferrari, Mar 14, 2006.

  1. atferrari

    Thread Starter AAC Fanatic!

    Jan 6, 2004
    There are three independent 16F877 (eventually 16F628), (no clock sharing), monitoring three inputs each. Depending if set or clear plus other internal variables the respective LEDs will flash, stay permanently on or permanently off.

    Additionally, each micro would be fitted with an RTC DS1307 for timestamping when the inputs go high.

    Being the three micros in the same functional level (exactly the same software with no one being master/supervisor of the rest) and without any additional glue logic, how could I:

    a - Have the required LEDs in the different modules, flashing at the same pace, even if a module (any one) is turned off?

    b - Have the three RTC synchronized for a meaningful time stamping?

    No one will be master of the rest and no data will be passed to anyone.

    Thanks for any good idea.
  2. Papabravo


    Feb 24, 2006
    Can you offer any evidence that such a solution even exists?
    As near as I can tell none of the units has any meaningful information from its neighbors and it has no facility for informing its neighbors what it is doing.
    Have I missed something here?

    I don't know if this will fit your parameters but if each processor has an input pin and an output pin and you connect them in a physical ring then each processor has a left neighbor and a right neighbor. Let us say that any processor wants to begin some sequence. He raises his output which goes to his right hand neighbor and begins his sequence. The right hand neighbor sees his input go high and he raises his output and starts the sequence. Now the 2nd processor's right hand neighbor is the first processor's left hand neighbor. So when he sees his input go high hes raises his output and begins the sequence. The processor which originated everything sees his input go high and he knows that the ring is unbroken.

    A similar method can be used to turn the "ring" off again. I'm not sure at the moment how to deal with one of the processors being off. Maybe if the ring was bi-directional so you could send a high output in either direction. That might do it but it would require four pins -- two inputs and two outputs. That's probably too many pins for you and the PIC16F628.

    I don't know how you expect the RTC's to be syncronized without passing data. Are you sure you're not spoofin' us?
  3. hgmjr

    Retired Moderator

    Jan 28, 2005
    One thing you might consider is using a squarewave oscillator the output of which is fed to one of the interrupts on each of the three microchips.

  4. n9352527

    AAC Fanatic!

    Oct 14, 2005
    You could delegate the flashing control for all LEDs to an external oscillator + drivers and send only on/off signals from the micros to the LED drivers.

    Synchronising the timestamp is more difficult. I would have to say you need to use one RTC which is shared amongst the micros. There is just no way to synchronise three RTC. If you don't want the micros to talk to each other then you have to devise a way to share the RTC I2C bus so that each micro is able to independently get the timestamp without clashing. Note that this would affect the timestamp of near simultaneous signals on different micros due to the RTC bus contention delay.
  5. atferrari

    Thread Starter AAC Fanatic!

    Jan 6, 2004
    Thanks for replying. If "spoofing" means what I see in the dictionary, No I have no time to spend in that. Definitely. My life is oriented to something better...

    Thanks for you ideas... I need to think on this a little more...
  6. Papabravo


    Feb 24, 2006
    You may have no time to spend "on that", but posing a problem with requirements that can not be satisfied amounts to the same thing.

    If there is a solution to syncronizing the three RTC's without data transfer then I will be greatly surprised. Even my "ring" solution from the previous post involved the transfer of one bit of information.