Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Remote

Remote 15 years 9 months ago #268

  • gallim
  • gallim's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 29
  • Karma: 0
Hi,
I tried to configure a node with communication to a remote system using Modbus on a serial line, but I did not find help or manuals on this topic.
Where can I look?

Thanks.

Maurizio
The administrator has disabled public write access.

Re:Remote 15 years 9 months ago #269

  • robert
  • robert's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 178
  • Karma: 7
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
The administrator has disabled public write access.

Re:Remote 15 years 9 months ago #270

  • gallim
  • gallim's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 29
  • Karma: 0
Hi Robert,
I thank you for your quick help.

/Maurizio
The administrator has disabled public write access.

Re:Remote 15 years 9 months ago #271

  • gallim
  • gallim's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 29
  • Karma: 0
Hi,
when build the node this error appear:
Build node gallima
-- Plc window generated Progetto1-prg1-W-RR1-W
In file included from /usr/local/pwrp/progetto1/common/tmp/plc_m000_001_001_001_0000003e.gc:22:
/usr/local/pwrp/progetto1/common/tmp/plc_cod000_001_001_001_0000003e.gc: In function 'M000_001_001_001_0000003e_exec':
/usr/local/pwrp/progetto1/common/tmp/plc_cod000_001_001_001_0000003e.gc:3: error: expected ')' before ';' token
/usr/local/pwrp/progetto1/common/tmp/plc_cod000_001_001_001_0000003e.gc:3: error: conversion to non-scalar type requested
/usr/local/pwrp/progetto1/common/tmp/plc_cod000_001_001_001_0000003e.gc:4: error: expected ')' before ';' token
/usr/local/pwrp/progetto1/common/tmp/plc_cod000_001_001_001_0000003e.gc:4: error: conversion to non-scalar type requested
/usr/local/pwrp/progetto1/common/tmp/plc_cod000_001_001_001_0000003e.gc:5: error: expected ')' before ';' token
/usr/local/pwrp/progetto1/common/tmp/plc_cod000_001_001_001_0000003e.gc:5: error: conversion to non-scalar type requested
** Plc window compiled with errors for x86_linux Progetto1-prg1-W-RR1-W
%GSX-F-CCERROR, Error from c compilator, see terminal window

???

Thanks for help.

Maurizio.
The administrator has disabled public write access.

Re:Remote 15 years 9 months ago #272

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3170
  • Thank you received: 497
  • Karma: 133
Hi Maurizio,

Remove the semicolon at the and of the #define statement, it should not be there and I think this is the problem.

/Claes
The administrator has disabled public write access.

Re:Remote 15 years 9 months ago #273

  • gallim
  • gallim's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 29
  • Karma: 0
Hi Claes,
under $ pwrp_inc in ra_plc_user.h I entered this code:

typedef struct {
pwr_tInt32 Id;
pwr_tInt32 data_1;
pwr_tFloat32 data_2;
} my_buf;

#define pwr_sClass_my_buf my_buf;

and section code of DataArithm-object:

classdef Da1 my_buf
OA1 = Da1->Id;
OA2 = Da1->data_1;
OA3 = Da1->data_2

/Maurizio
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 7.985 seconds