1. 01 (0x01) read coil output
Use this function code to read the state of 1 to 2000 coils from the remote address. The state of each coil can only be 0 or 1, and the number of read coils is specified by the master station when reading.
2. Send message format
The format of the MBAP message header is as follows:
the more detailed format is as follows:
MBAP message header + function code + high byte of start address + low byte of start address + high byte of coil quantity + low byte of coil quantity, a total of 12 bytes.
3. Return message format
The more detailed format is as follows:
MBAP message header + function code + byte count + low byte of coil status + ... + high byte of coil status, a total of N+9 bytes, N is the occupation of all coil statuses that need to be read The number of bytes (8 coils occupy one byte).
4. Case
Slave address: 1
Start address: 0
Number of coils: 10
Suppose you want to read 10 coil status values with slave address 1 and start address 0, then