This command is used to read the values of the DO digital outputs. Here is a table with the codes for reading and writing the Modbus RTU registers.īack to contents How can I send a Modbus RTU command to read discrete output? Command 0x01
The value of register 40108 when combined with register 40109 gives a 32 bit value.ģ2-bit single precision IEEE floating point numberīack to contents What are Modbus RTU commands? The AE 41 HEX value is 16 bits 1010 1110 0100 0001, can take a different value, depending on the type of representation. The analog output register AO2 has a value of 43 40 HEX or 17216 in the decimal system. The analog output register AO1 has a value of 56 52 HEX or 22098 in the decimal system. The analog output register AO0 has the value AE 41 HEX or 44609 in the decimal system. The low-order bit of the register (40 hex) The value of the upper register bit (43 hex) The low-order bit of the register (52 hex)
The value of the upper register bit (56 hex) The low-order bit of the register (41 hex) The value of the upper register bit (AE hex)
The number of bytes further (6 bytes follow) In response to the Modbus RTU Slave device we get: The number of required registers (reading 3 registers from 40108 to 40110)
The address of the first register (40108-40001 = 107 = 6B hex) THE ADDRESS OF THE SLAVEID DEVICE (17 = 11 HEX) The following is an example of a Modbus RTU request for obtaining the AI value of the holding registers from registers # 40108 to 40110 with the address of the device 17. The difference between these two quantities is “offset”.Įach table has its own offset, respectively: 1, 10001, 3001. The Modbus message uses the register address.įor example, the first register of AO Holding Register has the number 40001, but its address is 0000. Two tables are read-only and two are read-write. SlaveID is the address of the device, it can take a value from 0 to 247, addresses from 248 to 255 are reserved.ĭata in the module is stored in 4 tables. If you discard the SlaveID address and the CRC checksum, you get the PDU, Protocol Data Unit.
The Modbus RTU message consists of the address of the SlaveID device, the function code, the special data, depending on the function code and the CRC of the checksum. It uses RS-485, RS-422, RS-232 interfaces, as well as Ethernet TCP / IP networks (Modbus TCP protocol) for data transfer. Modbus -communication protocol is based on the master-slave architecture.
How can I send a Modbus RTU command to read discrete output? Command 0x01.Detailed description of the Modbus TCP protocol with command examples