Content
# #rancho-ynecita — 2025-11-28
**12:48 [Kevin](https://slack.com/archives/C09D358F91R/p1764362924334609):** This is the bull crap we have to go through to configure digital outputs on these scada boards to be controlled by modbus:
To configure *Unit 1 (Board 1)* so that Relays 1 through 4 are controlled by the "ghost" inputs on unused *Unit 20*, you need to calculate and write specific values to registers *324* and *325*.
Here are the calculations and the final values you need to write.
1. The Formula
Each relay configuration byte is calculated as:
$$(\text{Source Unit ID} \times 8) + \text{Input Bit Index}$$
_(Where Input 1 is index 0, Input 2 is index 1, etc.)_1.
*For Unit 20 (Source ID = 20):*
• *Relay 1 Source* (Unit 20, Input 1/Bit 0): $(20 \times 8) + 0 = \mathbf{160}$
• *Relay 2 Source* (Unit 20, Input 2/Bit 1): $(20 \times 8) + 1 = \mathbf{161}$
• *Relay 3 Source* (Unit 20, Input 3/Bit 2): $(20 \times 8) + 2 = \mathbf{162}$
• *Relay 4 Source* (Unit 20, Input 4/Bit 3): $(20 \times 8) + 3 = \mathbf{163}$
2. Configuration Registers to Write
The system packs two relay settings into a single 16-bit register (High Byte + Low Byte).
*Register 324: Controls Relays 1 & 2*
• *Low Byte (Relay 1):* 160
• *High Byte (Relay 2):* 161
• *Final Value Calculation:* $(161 \times 256) + 160 = \mathbf{41376}$
•
• *Action:* Write *41376* to Register *324*2.
•
•
*Register 325: Controls Relays 3 & 4*
• *Low Byte (Relay 3):* 162
• *High Byte (Relay 4):* 163
• *Final Value Calculation:* $(163 \times 256) + 162 = \mathbf{41890}$
•
• *Action:* Write *41890* to Register *325*3.
•
•
3. How to Control Them Afterward
Once configured, your relays on Unit 1 will listen to the digital inputs of Unit 20. Since Unit 20 is unused, you simulate these inputs by writing to *Register 200* (Unit 20 Digital Inputs)4.
• *Turn ON Relay 1:* Write *1* (Bit 0) to Register 200.
• *Turn ON Relay 2:* Write *2* (Bit 1) to Register 200.
• *Turn ON Relay 3:* Write *4* (Bit 2) to Register 200.
• *Turn ON Relay 4:* Write *8* (Bit 3) to Register 200.
_Note: To turn on multiple relays at once, add the numbers together (e.g., write *15* to turn on all four)._
**12:49 [Kevin](https://slack.com/archives/C09D358F91R/p1764362951285949):** the formatting is messed up coming from Gemini, but I think you get the picture
**12:49 [Mason Radke](https://slack.com/archives/C09D358F91R/p1764362985796809):** Damn, that’s kind of crazy. Is there a software to make that any easier?
**12:50 [Kevin](https://slack.com/archives/C09D358F91R/p1764363046984529):** there is, but for the newer boards I guess. I can't get it to work right with the older boards
**12:50 [Kevin](https://slack.com/archives/C09D358F91R/p1764363052282059):** its all junk
**12:51 [Kevin](https://slack.com/archives/C09D358F91R/p1764363064683919):** and only one guy is tech support
**12:51 [Kevin](https://slack.com/archives/C09D358F91R/p1764363089088249):** I'm thinking of scrapping these to save us the time to put this together
**12:52 [Kevin](https://slack.com/archives/C09D358F91R/p1764363142504899):** my brain is being resistant to figuring this out. too complicated.
**12:55 [Mason Radke](https://slack.com/archives/C09D358F91R/p1764363313472799):** How can I help?
**14:53 [Kevin](https://slack.com/archives/C09D358F91R/p1764370438938269):** I'm making myself follow through and do it.
**14:54 [Kevin](https://slack.com/archives/C09D358F91R/p1764370446689629):** thanks for the offer
**14:55 [Mason Radke](https://slack.com/archives/C09D358F91R/p1764370528543439):** It’s good exercise for the brain