Specifications
sigmadue - IEC 61131-3 Function Block Library
124
5-2-3 Modbus Master protocol
The sigmadue CPU device firmware includes the communications primitives for
MODBUS MASTER RTU (see “
Serial Communication Function Block Library
”).
The definition of Function Blocks simplifies its use and enables to define the
sequence of messages to be generated by the MODBUS master, after correctly
configurating the communications port. The following example shows how to use
the library master Function Blocks
1
.
In this case two different slave devices (address 1 and address 2) are accessed in
sequence for three times.
MB_MST_SYNC
Function Block gives access to one of
the three other present modules: each one will be enabled after the operation of
the previous one is terminated, whereas the order is set by the
SEQ
input of each
Function Block.
For further details on these Function Blocks, see the specific documentation of the
individual module.
1. For their correct operation,
MB_MST_xx_yyy
Function Blocks need some global
variables that have to be linked during compilation. In Ascon template these variables
are included in “
SystemDirectVar.POE
” and “
SystemVar.POE
” files.
NR_SEQ
MB_MST_SYNC
COIL1
ARRAY2
ENABLE
NR_CMD
TRUE
3
MB_FAIL
MB_TOUT
MB_ERR
MB_STS
MB_OPRS
MB_MST_SYNC
SEQ
NR_SEQ
NODE
MB_FUNC
REG
W_BIT
T_OUT
RETRY
1
1
5
1
MB_FAIL
MB_TOUT
MB_ERR
MB_STS
MB_OPRS
MB_MST_WR_WORD
SEQ
NR_SEQ
NODE
MB_FUNC
REG
NR_REG
W_REG
T_OUT
RETRY
2
2
6
10
5
R_REG
MB_FAIL
MB_TOUT
MB_ERR
MB_STS
MB_OPRS
MB_MST_RD_WORD
SEQ
NR_SEQ
NODE
MB_FUNC
REG
NR_REG
T_OUT
RETRY
3
1
3
1
10