Do you want to change the state of one port or both with a single command? To clarify, what I'm calling Port A and B are the two sets of outputs per peripheral.Tho' i think my method (above) may use fewer bits.
Your method:
controller: 01, 00, 001, 110
(node address 01, command 00, first port 01, second port 10)
Or maybe you mean:
controller: 01, 001
controller: 01, 110
(node address 01, first port 01)
(node address 01, second port 10)
My method is positional. Also, it makes more sense for my application to combine them into one command.
controller: 01, 00, 01, 10
(node address 01, command 00, first port 01, second port 10)
I wouldn't create a separate variable for every output, because the number of nodes, and number of outputs, is unpredictable.p1_portA_outputA
bothwant to change the state of one port or both with a single command
For me, if..then's don't feel like the right fit for this project. Too procedural. A more direct translation from the binary to the outputs seems a better fit. A kind of state-machine, i think.Peripheral uses If - Then

This is a new problem but still requires sequential logic. The first post I made with the 2 to 4 Line Decoder is an example of a combinational logic circuit which can be defined as obeying a truth table.i think i can eliminate addressing.
On every communication cycle, the controller is always talking to each node in sequence. The first command is for the first node, second command is for second node, etc.
That brings the issue of, how can a node know which command is meant for it, when it doesn't know how many nodes are in the network, and it doesn't know it's own position?
Possible solution: Serial connections, instead of a bus.
View attachment 307443
- Controller sends Node 1 command directly to Node 1.
- Node 1 send confirmation back, and passes all remaining messages to Node 2. Node 1 ignores remaining messages.
- Controller sends Node 2 command to Node 1. Since Node 1 already received it's message, it passes the message down the wire to Node 2. It also passes Node 2's confirmation back up the wire to Controller
- etc
So... how to get a node to latch first command it receives, and pass through all others? Hmm.
Maybe, maybe not. See https://forum.allaboutcircuits.com/threads/latch-and-ignore.197186This will require many decode logic circuits all over the place.
I'd like to minimize wires, commands, and handshakes. I like the 1-wire protocol, but even that's too complex for my tasteThis is why I've been pushing an I2C solution.