Menu

need to serial daisy chain several pics

Help
2008-08-08
2013-05-30
  • Ryan Mystique

    Ryan Mystique - 2008-08-08

    I need to put several pics on the same lines and have them tx when they get a unique rx each, what would be the code to do this? on  12 series pics

     
    • kent_twt4

      kent_twt4 - 2008-08-09

      Looks I may have lost my other post on the new SourceForge site/changeover?  If it reappears when switching back to the new site, then this will look like a double post.

      Try a NRZ scheme of encoding a signal, Wiki or Google that.  Another way is adding a clock to that, which is called Manchester encoding.  In the NRZ scheme the high state is achieved by putting a pullup resistor, (or internal pullup?) on the data pin.  A one's state is acheived by making the data an input 'dir GPIO.x in'.  A zero's state is achieved by making the data pin an output 'dir GPIO.x out', and then 'Set GPIO.x Off'

      You could have all your slaves sitting in a loop checking to see when GPIO.x goes low for a period that is longer than a two byte transmission (i.e. Synch pulse).  Master code would send synch pulse, slave address, dummy termination byte, then goto RCV_Pulse and wait for synch pulse back from slave, then goto RCV_Pulse for slave data, RCV_Pulse slave termination byte, then start all over again.

      Get that working, then maybe add interrupt code to wake up from sleep and do something then go back to sleep. 

      Note:  A Slave needs to send a second termination byte that would flag other slaves to ignore the case when a slave sends a synch pulse, then a data byte that matches another slaves address!!

       

       
    • Ryan Mystique

      Ryan Mystique - 2008-08-09

      Isn't there a way to just have them all on the same line and when "xxx" comes down the wire they all get it but only the one that is looking for "xxx" sends out it's a/d readings on a seperate send line( seperate rx and tx pins on pic) ?

       
    • Ryan Mystique

      Ryan Mystique - 2008-08-12

      Does anybody know of a way?

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.