Example 1: SEND_REQ function with Echo request. Schneider Electric PL7 Micro/Junior/Pro - Communication applications, volume 2
விளம்பரம்
விளம்பரம்
Modbus programming
Example 1: SEND_REQ function with Echo request
At a Glance
Question
This example concerns the Echo diagnostics function. This function requests that the interrogated slave return the message sent by the master in full.
The communication function is as follows:
SEND_REQ(ADR#0.1.x,16#9F,%MW10:10,%MW50:30,%MW100:4)
Before sending the function it is necessary to initialize the following words:
Words
%MW10
Value Description
:= 16#0008 corresponds to the Echo function (byte 0 = 16#08, byte 1
=16#00
%MW11
%MW12
:= 16#0296 corresponds to the identification of the Modbus function
:= 0 reserved
%MW13 := 16#1234 corresponds to the Echo function parameter. For this example, the slave must return the value 16#1234
%MW103 := 8 (bytes) length of the data to be transmitted in bytes
Response
%MW50
:= 0 if action taken
:= 1 if action not taken
The slave response, contained in the %MW50:30 reception buffer, is of type:
%MW51 Description
:= 16#0008 corresponds to the Echo function (byte 0 = 16#08, byte 1 =16#00)
%MW52 to %MW79 contain the Modbus response data. For this example
%MW52:= 1234
:= 16#0007 incorrect request parameters
:= 16#0004 incorrect question parameters
:= 16#0688 byte 0 =16#80 + function code (16#08 for Echo) byte 1 = 16#06 Modbus error code (the slave is busy)
:= 16#0188 byte 0 =16#80 + function code (16#08 for Echo) byte 1 = 16#01 Modbus error code (the function is unknown)
:= 16#0388 byte 0 =16#80 + function code (16#08 for Echo) byte 1 = 16#03 Modbus error code (the data is invalid)
TLX DS COM PL7 xxE
43
பதிவிறக்கு
விளம்பரம்