Hi Maurizio,
Unfortunately I must inform you that documentation on communication is very poor. On some of the classes involved there is some documentation but we really lack one doucument describing \"everything\". I'm actually a bit surprised that no one has asked questions about communication in the past.
I will give you a short \"tutorial\" below and also promise you that there will, during the summer, be released a document describing the communication possibilities of Proview and how to configure it.
Tutorial
1. RemoteConfig
Place a RemoteConfig in the node-hierarchy.
2. RemNode's
Below the RemoteConfig-object you place a RemnodeXXX object for each communication link you will have in your system, where XXX can be for example TCPIP, UDP, Serial, Modbus. You place a RemnodeModubs-object here.
3. RemTrans's
For each type of message you will send or receive to/from the remote node you place a Remtrans-object below the corresponding RemNode. Configuring the RemTrans-object differs for every protocol. In your case:
RemTrans.Address[0] is the slave-address
RemTrans.Address[1] is the modbus function code.
RemTrans.Direction is the direction of the message. 1 for receiving 2 for sending.
RemTrans.DataLength the size of the data in the buffer to send (see below).
4. Buffers
This is the data area for the message. Below each RemTrans you place a buffer big enough for the message. For example a buffer of type Buff256.
5. Sending / Receiving
In the plcpgm you use the Remote-classes RemTransSend and RemTransRcv. Place a corresponding object in a plcpgm. Connect the correct remtrans-object to the Trs-input pin on the RemTransSend/Rcv (just drag and drop from the pin to create a GetData-object).
6. Coding
Open the subwindow of the RemTransRcv/Send-object. Create a DataArithm-object. To Da1-inpin connect the corresponding buffer. Write som c-code to fill or read from the buffer. For example:
c[code:1]
//in ra_plc_user.h (for example)
typedef struct {
pwr_tInt32 Id;
pwr_tInt32 data_1;
pwr_tFloat32 data_2;
} my_buf;
#define pwr_sClass_my_buf my_buf // this has to be for the classdef below to work
//in DataArithm
classdef Da1 my_buf // or a self-defined struct
OA1 = Da1->Id;
OA2 = Da1->data_1;
OA3 = Da1->data_2;
[/code:1]
Save the output-data to some Av-signals.
In your case the data-buffer corresponds to the message you send or receive according to the used function code. This you have to know yourself.
End \"tutorial\".
Modbus TCP however is implemented as an I/O-system and described in \"Guid to I/O-systems\" This is not the case with Modbus Serial RTU. Hopefully this will get you a little bit on the way.
/Robert
Post edited by: robert, at: 2008/06/18 11:55
Post edited by: robert, at: 2008/06/18 12:23
Post edited by: admin, at: 2008/06/19 14:03