Communication
2.3 Modbus communication
SIMOCODE pro - Communication
106
Function Manual, 11/2018, A5E40508495002A/RS-AC/003
Function code 23 - Read/Write Multiple Registers
Function
This function enables the Modbus master system to write and read several registers from
SIMOCODE using a single function call. The write operation is the first executed operation
here. This function is the typically used function call for outputting cyclic data in SIMOCODE
and for reading back inputs or device statuses.
A valid address from the register memory area is expected as the start address. The
selected address must be designated as writable (see the tables in Section Modbus RTU
data tables (Page 277), "Access" column).
Request message frame
Slave
address
Function
code
Start
address
read
operation
Number of
registers
(read
access)
Start
address
write
operation
Number
of
registers
N (write
access)
Number
of
bytes
(write
access)
Data
(write
access)
CRC
1 byte
1 byte
2 bytes
2 bytes
2 bytes
2 bytes 1 byte
Nx2bytes 2
bytes
Response message frame
Slave address
Function code
Number of
bytes N
Data
CRC
1 byte
1 byte
1 byte
Nx2 bytes
2 bytes
Example
Writing the outputs and reading back the input signals of the SIMOCODE pro device. To do
this, register 0x0000 in the PIQ (process image output) is written, and at the same time,
4 registers from 0x0400 in the PII (process image input) are read. Slave address of the
SIMOCODE pro = 16 (10h).
The register written to SIMOCODE here is to start the motor in clockwise rotation
in "Remote" mode (24h).
In this example, it must be noted that the requested function "Start motor clockwise" is not
returned in the same cycle as the new status. This is due to the ON command execution
time in SIMOCODE and the delay of the contactors. Not until a few communication cycles
later will the feedback signal of the PII also begin with 0x0024.
Note
Read/Write Multiple Registers
The FC23 can only access the PII/PIQ.