6. COMMUNICATIONS SUPPORTED MODBUS FUNCTIONS
6-5
6.3.2
FUNCTION CODES 01 AND 02 - READ RELAY COIL AND DIGITAL INPUT STATUS
Modbus implementation: Read Coil and Input Status
SR469 Implementation: Read Relay Coil and Digital Input Status
For the SR469 implementation of Modbus, these commands can be used to read Relay Coil Status or Digital Input Status.
Function 01
The standard implementation requires the following: slave address (one byte), function code (one byte), starting relay coil (two byte),
number of coils to read (two bytes), and CRC (two bytes). The slave response is the slave address (one byte), function code (one byte),
byte count of relay coil mask (one byte – always 01 since only six relay coils in the relay), bit mask indicating the status of requested
relay coils (one byte), and CRC (two bytes).
Function 02
The standard implementation requires the following: slave address (one byte), function code (one byte), starting digital input (two byte),
number of digital inputs to read (two bytes), and CRC (two bytes). The slave response is the slave address (one byte), function code
(one byte), byte count of digital input mask (one byte), bit mask indicating the status of requested digital inputs (one or two bytes), and
CRC (two bytes).
Note: the CRC is sent as a two byte number with the low order byte sent first.
Message Format and Example:
Function 01:
Request slave 11 to respond with status of relay coil 3 to 5:
Relay
Status
R1 Energized
R2 De-energized
R3 De-energized
R4 De-energized
R5 Energized
R6 Energized
Bit Mask 0011 0001 (0 x 31)
Master Transmission Bytes Example (hex)
SLAVE ADDRESS 1 0B message for slave 11
FUNCTION CODE 1 01 read relay coil status
STARTING RELAY COIL 2 00 starting at relay coil 3
03
NUMBER OF RELAYS 2 00 3 relay coils (i.e. R3, R4, R5)
03
CRC 2 8C CRC calculated by the master
A1
Slave Response
SLAVE ADDRESS 1 0B message from slave 11
FUNCTION CODE 1 01 read relay coil status
BYTE COUNT 1 01 1 byte bit mask
BIT MASK 1 10 bit mask of requested relay
(0001 0000)
CRC 2 53 CRC calculated by the slave
9C
NOTE
: If STARTING RELAY COIL (STARTING DIGITAL INPUT) of Zero is entered, then SR469 will default it to One.
If the NUMBER OF RELAYS (NUMBER OF DIGITAL INPUTS) requested exceeds the number of relays available then user will
be prompted with a “ILLEGAL DATA” message.