Programming instructions
6.3 Global library instructions
the data block and assign the data type structure that will be read from and written to, before
it can be used with the MB_SLAVE instruction.
Note
The Modbus Holding Register data block must reference a global data block which was
created with the Symbolic Access Only attribute box unchecked.
You must uncheck the "Symbolic address only" box when you add a new Data block to
create a classic global DB type.
The holding registers can use these DB data structures:
● Standard array of words
● Named word structure
● Named complex structure
The following program examples show how to use the MB_HOLD_REG parameter to handle
these DB data structures.
Example 1 - Standard array of words
This example holding register is an array of words. The data type assignments can be
changed to other word size types (INT and UINT).
Advantages:
Disadvantages:
This is how an array of words structure would appear in the data block editor.
The image below shows how the array would be assigned to the MB_HOLD_REG input of an
MB_SLAVE instruction.
202
This type of holding register structure is very fast and simple to
create.
The program logic to access a data element is simplified.
Although you can programmatically reference each array element
by the symbolic names ("HR_DB"."Array"[1] through
"HR_DB"."Array"[10]), the names do not describe the internal
function of the data.
The array can consist of only one data type. Type conversions may
be required in a user program with rigid type control.
S7-1200 Programmable controller
System Manual, 11/2009, A5E02486680-02