The following commands make use of a RelayNumber parameter, which are always 16-bit values. The RelayNumber is a the number of the relay you would like to control. This RelayNumber variable is converted into LSB and MSB values, which is subsequently communicated to the controller.
RelayNumber = The Relay Number you would like to control.
LSB = ((RelayNumber) And 255)
MSB = (((RelayNumber) And 65280) / 255)
Since most users will be working with less than 256 relays, the following substitutions can be made to help simplify this process:
LSB = Relay Number (0 to 255)
MSB = 0
Should you need to speak to more than 256 relays, changing the MSB to 1 will only speak to relays above 256. The following values will only talk to relays 256 to 511:
LSB = Relay Number (0 to 255)
MSB = 1 (This will send the LSB above to relays 256 through 512)
Commands Below are in Hex Format using API Mode. TX = Bytes Sent to the Controller RX = Bytes Received from the Controller. Note Bytes Received May be Different for Some Commands.
TX: | 2 | 3 | 4 | LSB | MSB | CKS | Function | RX: | 2 | 3 | 4 |
---|---|---|---|---|---|---|---|---|---|---|---|
AA | 04 | FE | 2C | 00 | 00 | D8 | Read the Status of Relay 1 | AA | 01 | 00 | AB |
AA | 04 | FE | 2C | FF | 00 | D7 | Read the Status of Relay 256 | AA | 01 | 00 | AB |
AA | 04 | FE | 2C | 00 | 01 | D9 | Read the Status of Relay 257 | AA | 01 | 00 | AB |
AA | 04 | FE | 2E | 00 | 00 | DA | Turn Off All Relays then Activate Relay 1 | AA | 01 | 55 | 00 |
AA | 04 | FE | 2E | FF | 00 | D9 | Turn Off All Relays then Activate Relay 256 | AA | 01 | 55 | 00 |
AA | 04 | FE | 2E | 00 | 01 | DB | Turn Off All Relays then Activate Relay 257 | AA | 01 | 55 | 00 |
AA | 04 | FE | 2F | 00 | 00 | DB | Turn Off Relay 1 | AA | 01 | 55 | 00 |
AA | 04 | FE | 2F | FF | 00 | DA | Turn Off Relay 256 | AA | 01 | 55 | 00 |
AA | 04 | FE | 2F | 00 | 01 | DC | Turn Off Relay 257 | AA | 01 | 55 | 00 |
AA | 04 | FE | 30 | 00 | 00 | DC | Turn On Relay 1 | AA | 01 | 55 | 00 |
AA | 04 | FE | 30 | FF | 00 | DB | Turn On Relay 256 | AA | 01 | 55 | 00 |
AA | 04 | FE | 30 | 00 | 01 | DD | Turn On Relay 257 | AA | 01 | 55 | 00 |