PDA

View Full Version : Is it possible to daisy chain several PICs via serin/serout statements?



CuriousOne
- 2nd February 2025, 07:54
Hello.

I have a device which controls specific led module, it is based on PIC16F722 and is driven via 1 wire serial interface.
So is it possible to connect these modules in series, to control with single pin?
Each module receives 8 bytes of data from host.
So say I want to connect in series 8 of such modules, this means that first module should receive first 8 bytes and so something with them as needed, and forward next incoming bytes to the next module and so on. But how to do this?

I understand this as there is an array with 64 byte size. The first module receives that 64 byte "packet" and then outputs 64-8=56 bytes to the next module, which receives it, does whatever needed and then forwards 56-8=48 bytes to the output and so on.

Technically, I can "hard code" such modules, and that will work, but is there a possibility to do this in an infinite way? like serial connection of 74HC595 shift registers?

Jerson
- 3rd February 2025, 01:24
Typically you would do something like this using RS485 for control systems or DMX for lighting.

Ioannis
- 5th February 2025, 22:50
What you describe is something like what addressable led strips use, like WS2812B and APA102 to name a couple of these.

This, as you said can be made with arrays. It is the responsibility of the host device to send the appropriate number of bytes to the slave devices.

If the bytes are less the further devices will not get the data they need. If bytes are more, some will just get lost.

The downside as I see it, is the small speed you will obtain.

So, as Jerson noted, a protocol like RS485 is always better solution and more robust. Plus faster.

In any case if you want it simple, use Hserin/Hserout.

Ioannis