Siemens SIMATIC S7-200 System Manual page 372

Programmable controller
Hide thumbs Also See for SIMATIC S7-200:
Table of Contents

Advertisement

S7-200 Programmable Controller System Manual
The parameter Count specifies the number of data elements to read or write in this request. The
Count will be the number of bits for the bit data types, and the number of words for the word data
types.
Address 0xxxx
-
Address 1xxxx
-
Address 3xxxx
-
Address 4xxxx
-
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 DataPtr is an indirect address pointer which points to the V memory in the S7-200
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 S7-200 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.
Table 12-9
Parameters for the MBUS_MSG Instruction
Parameter
First
Slave
RW
Addr
Count
DataPtr
Done
Error
Holding registers (address 4xxxx) and input registers (address 3xxxx) are word values (2 bytes or
16 bits). S7-200 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 S7-200 byte
and word addressing corresponds to the Modbus register format.
Table 12-10 Modbus Holding Register
S7-200 CPU Memory
Byte Address
Address
VB200
VB201
VB202
VB203
VB204
VB205
The bit data (addresses 0xxxx and 1xxxx) areas are read and written as packed bytes, that is, 8
bits are packed into each byte of data. The least significant bit of the first data byte is the
addressed bit number (the parameter Addr). If only a single bit is written then the bit must be in the
least significant bit of the byte pointed to by DataPtr.
358
Count is the number of bits to read or write
Count is the number of bits to read
Count is the number of input register words to read
Count is the number of holding register words to read or write
Data Type
Operands
BOOL
I, Q, M, S, SM, T, C, V, L (Power flow conditioned by a positive edge
detection element)
BYTE
VB, IB, QB, MB, SB, SMB, LB, AC, Constant, *VD, *AC, *LD
BYTE
VB, IB, QB, MB, SB, SMB, LB, AC, Constant, *VD, *AC, *LD
DWORD
VD, ID, QD, MD, SD, SMD, LD, AC, Constant, *VD, *AC, *LD
INT
VW, IW, QW, MW, SW, SMW, LW, AC, Constant, *VD, *AC, *LD
DWORD
&VB
BOOL
I, Q, M, S, SM, T, C, V, L
BYTE
VB, IB, QB, MB, SB, SMB, LB, AC, *VD, *AC, *LD
S7-200 CPU Memory
Word Address
Hex Data
Address
12
VW200
34
56
VW202
78
9A
VW204
BC
Modbus
Holding Register Address
Hex Data
Address
12 34
4001
56 78
4002
9A BC
4003
Hex Data
12 34
56 78
9A BC

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents