Download User Manual PROGRAMMABLE REMOTE INPUT/OUTPUT
Transcript
SiAM CRIO v3.0 User Manual 8.3.- Modbus functions The SiAM CRIO borrad supports the modbus RTU protocol functions described in the following sections. As frames are limited to 256 bytes, is not possible to read or write more than a hundred modbus registers in a single transaction. In all examples the slave address is 128 (0x80). 8.3.1.- Read Holding Registers (0x03) This function code is used to read the contents of a contiguous block of holding registers. The following example reads holding register 0x0000: Request Field name Slave address Function Starting address (HI) Starting address (LO) Number of registers (HI) Number of registers (LO) Checksum (HI) Checksum (LO) Value (Hex) 0x80 0x03 0x00 0x00 0x00 0x01 0x9A 0x1B Response Field name Slave address Function Byte count Value of register 0x0000 (HI) Value of register 0x0000 (LO) Checksum (HI) Checksum (LO) Value (Hex.) 0x80 0x03 0x02 0x00 0x00 0x84 0x5A 8.3.2.- Read Input Registers (0x04) Identical to the previous one. In this example, registers 0x0200-0x0201 are read: Request Field name Slave address Function Starting address (HI) Starting address (LO) Number of registers (HI) Number of registers (LO) Checksum (HI) Checksum (LO) Response Value (Hex.) 0x80 0x04 0x02 0x00 0x00 0x02 0x6E 0x62 Field name Slave address Function Byte count Value of register Value of register Value of register Value of register Checksum (HI) Checksum (LO) 0x0200 0x0200 0x0201 0x0201 (HI) (LO) (HI) (LO) Value (Hex.) 0x80 0x04 0x04 0x45 0x02 0x00 0x00 0xDE 0x40 The read value of register 0x0200 is 0x4502, and the value of register 0x0201 is 0x0000. Page 64