Libraries
9.3 Modbus library instructions
S7-200 SMART
440 System Manual, 09/2015, A5E03822230-AC
The MBUS_MSG instruction will read or write a maximum of 120 words or 1920 bits (240
bytes of data). The actual limit on the value of Count will depend upon the limits in the
Modbus slave device.
The parameter
is an indirect address pointer which points to the V memory in the
CPU for the data associated with the read or write request. For a read request, DataPtr
should point to the first CPU memory location used to store the data read from the Modbus
slave. For a write request, DataPtr should point to the first CPU memory location of the data
to be sent to the Modbus slave.
The DataPtr value is passed into MBUS_MSG as an indirect address pointer. For example, if
the data to be written to a Modbus slave device starts at address VW200 in the CPU, the
value for the DataPtr would be &VB200 (address of VB200). Pointers must always be a type
VB even if they point to word data.
Holding registers (address 4xxxx or 4yyyyy) and input registers (address 3xxxx) are word
values (2 bytes or 16 bits). CPU words are formatted the same as Modbus registers. The
lower numbered V memory address is the most significant byte of the register. The higher
numbered V memory address is the least significant byte of the register. The table below
shows how the CPU byte and word addressing corresponds to the Modbus register format.
Table 9- 26 Modbus Holding Register
Modbus holding register address
VB202 56 VW202 56 78 40002 56 78
VB204 9A VW204 9A BC 40003 9A BC