1. 02 (0x02) read coil input
Use this function code to read the state of 1 to 2000 input 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 header is as follows:
The more detailed format is as follows:
MBAP message header + function code + high start address + low start address + high number of coils + low number of coils, a total of 12 bytes.
3. Return message format
The more detailed format is as follows:
MBAP message header + function code + byte count + 1st coil status byte + ... + Nth coil status byte, a total of N+9 bytes, N is to be read The number of bytes occupied by all coil states (8 coils occupy one byte).
4. Case
Slave address: 1
Start address: 0