Specifications

sigmadue - IEC 61131-3 Function Block Library
122
5-2-2 Modbus Slave Protocol
Once the communication port has been configured as slave (or server in case of
MODBUS/TCP), the data exchange between the program written in the IEC61131
environment and the memory area, that can be seen from the master (or client in
case of MODBUS/TCP), can occur in two different ways:
by declaring and using the %M variables;
by using the Function Blocks in AsconMBCommLib library.
The first one is described in serial communications manual
[3]
, and it needs the
declaration of variables in the %M area that will be assigned to the process
variables.
The second mode provides the direct access to the central unit internal memory,
that can be seen from the communications master (or client in case of MODBUS/
TCP), without using %M variables.
The following is an example of memory access using the Function Blocks present
in the library.
Note that in this case a word writing updates the memory area that the
communications master (or client in case of MODBUS/TCP) will subsequently
read. This means that
MB_SLV_XX_YYYY
Function Blocks are always to be used
for SLAVE protocols and update the memory area that the communication
smaster accesses. The following block diagram clarifies the access modes to the
different memory areas.
OPRSSLAVE1
5
SLAVE1
5
DATA1
MB_SLV_WR_WORD
SLAVE_ID
REGISTER
DATA
AD_MODE
OPRS
OUT1
OUT2
OUT3
OUT4
OUT5
OUT6
OUT7
OUT8
MB_SLV_RD8_REAL
SLAVE_ID
REGISTER
AD_MODE