Using Send_Req in Unity

G

Thread Starter

Greg

Hello, I am trying to read some data from a device on Modubs using the Send_Req block and function code 16#04 for reading 3x registers. I have a Premium processor and a TSX 114 PCMCIA card. I am able to use the Read_Var and Write_Var to access 4x registers, but the documentation for the Send_Req seems to only list examples for TCP/IP setups.

Can anyone give a brief example of how to setup the Send_Req function to accomplish this?

Thanks.
 
R

Rohit Mittal

THE VALUES FROM THE SCANNER CAN BE READ BY SEND REQUEST The Following example reads the values from a scanner with slave id 1.
====================================================
%MW1355:=16#0004;(*'00' is default and '04' is function code*)
%MW1356:=16#0296;(*'0296 is use of send request for Modbus function*)
%MW1357:=16#0000;(*'0000' is reserved*)
%MW1358:=16#0000;(*'0000' is staring address in LSB firstand MSB second format*)
%MW1359:=16#0800;(*'0010' is number of registers*)
%MW1253:=10;
(*From Scanner 1*)
SEND_REQ(ADR#0.1.12,16#009F,%MW1355:5,%MW1800:20,%MW1250:4);
(*adr0.1.x , 'x' is the salve id*) The scanned values will be stored from %mw1800 to %mw1820
DESCRIPTION IN DETAIL

The SEND_REQ communication function syntax appears in the following

form:SEND_REQ (ADR#0.0.6, 15, %MW0: 1, %MW150: 24, %MW40: 4)

The following table describes the function's different parameters.
Parameter
Description

ADR#0.0.6 The destination entity address for the exchange. The following {Station Network} APP addresses, {Station Network}APP.num and the (ALL) broadcast addresses are forbidden in this field.
15 This parameter specifies the value of the request code in accordance with the UNI-TE standard. It is decimalized by default (example: 252 for non-solicited data requests). If the user wants to code the requests hexadecimally, the code request must have the following syntax: 16# followed by a hexadecimal code request (example 16#FC for the request for non-solicited data).
%MW0:1 Data to be transmitted. The size of the word table depends upon the send request.It must have a minimum length of one word even if the request does not consist of any particular data to be transmitted (request Run, Stop, Identification, etc.). The length of the data to be transmitted must be memorized in the fourth word of the parameter manager (word length) before launching this function.
%MW150:24 Word table containing the reply data. It must have a minimum length of one word even if the request does not consist of any particular data to be received (request non-solicited data). The length of the data actually received is indicated at the end of the exchange, in the fourth word of the parameter manager.
%MW40:4 Parameter Manager The operation report takes one of the following values: 16#00: correct operation
16#02: incorrect reply
16#FD: operational error
Other values:
Request code + 16#30: upon positive reply for certain requests
16#FE: upon positive reply for certain requests
16#FB: upon reply to a mirror request
 
Top