Siemens SIMATIC S7-200 System Manual page 373

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

Advertisement

Figure 12-1
Format for Packed Bytes (Discrete Input Addresses)
For bit data addresses that do not start on even byte boundaries, the bit corresponding to the
starting address must be in the least significant bit of the byte. See below for an example of the
packed byte format for 3 bits starting at Modbus address 10004.
Figure 12-2
Format for Packed Bytes (Discrete input starting at address 10004)
When writing to the discrete output data type (coils), the user is responsible for placing the bits in
the correct bit positions within the packed byte before the data is passed to the MBUS_MSG
instruction via DataPtr.
The Done output is off while a request is being sent and the response is being received. The
Done output is on when the response is complete or when the MBUS_MSG instruction was
aborted because of an error.
The Error output is valid only when the Done output is on. See the Modbus Master MBUS_MSG
Execution Errors returned by the MBUS_MSG instruction.
The low numbered error codes (1 through 8) are errors that are detected by the MBUS_MSG
instruction. These error codes generally indicate a problem with the input parameters of the
MBUS_MSG instruction, or a problem receiving the response from the slave. Parity and CRC
errors indicate that there was a response but that the data was not received correctly. This is
usually caused by an electrical problem such as a bad connection or electrical noise.
The high numbered error codes (starting with 101) are errors that are returned by the Modbus
slave device. These errors indicate that the slave does not support the requested function or that
the requested address (either data type or range of addresses) is not supported by the Modbus
slave device.
Table 12-11 Modbus Master MBUS_MSG Execution Error Codes
Error Codes
Description
0
No Error
1
Parity error in response: This is only possible if even or odd parity is used. The
transmission was disturbed and possibly incorrect data was received. This error is
usually caused by an electrical problem such as incorrect wiring or electrical noise
affecting the communication.
2
Not used
3
Receive timeout: There was no response from the slave within the Timeout time.
Some possible causes are bad electrical connection to the slave device, master and
slave are set to a different baud rate / parity setting, and incorrect slave address.
4
Error in request parameter: One or more of the input parameters (Slave, RW, Addr,
or Count ) is set to an illegal value. Check the documentation for allowed values for
the input parameters.
5
Modbus master not enabled: Call MBUS_CTRL on every scan prior to calling
MBUS_MSG.
Using the Modbus Protocol Library
Vx.7
10008
10007
10006
10005
Vx.7
Vx.0
10001
10002
10003
10004
Vx.0
10004
10005
10005
Chapter 12
359

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents