CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Thu Oct 19, 2017 8:47 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 81 posts ]  Go to page Previous 1 2 3 4 5 6 Next
Author Message
PostPosted: Thu Jul 28, 2016 9:35 am 
Offline

Joined: Sat Jun 27, 2015 10:14 pm
Posts: 2
Question from my colleague — Alexander

Good time, experts CDS.

I will try to describe more the problem.

Experiences spend on PI-2 mod.B

There is a controller that has only RS-232, with fixed settings ID 16, 115200,8,N,1.

There is such piece of iron - USR-TCP232-2 http://www.usriot.com/p/rs232-to-ethernet-modules/. Works perfectly in mode RTU over TCP.

But, as You know, CDS are not able to understand this format. Or serial, or TCP.

To solve this problem, I tried to use the socat program http://www.dest-unreach.org/socat/ team socat PTY,link=/dev/ttyCOM tcp:192.168.3.55:502, which creates the most symbolic file /dev/ttyCOM, (lrwxrwxrwx 1 root root 10 Jul 26 10:56 /dev/ttyCOM -> /dev/pts/0)


When experimenting with OpenHab, also had to add the permission to the specified "port" in start.sh -Dgnu.io.rxtx.SerialPorts=/dev/ttyCOM. Although, everything is perfectly functioning.

Now.

By analogy with these often change CODESYSControl.cfg to work with RS-485/USB Converter I tried to add /dev/ttyCOM in the file /etc/CODESYSControl.cfg
Code:
[SysCom]
Linux.Devicefile=/dev/ttyCOM
portnum := COM.SysCom.SYS_COMPORT1;

however, nothing happens, not picks up data CoDeSys...
What needs to be done in the /etc/CODESYSControl.cfg [SysCom]

It seems that clearly outlined the problem.

I hope for understanding and help.


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Fri Jul 29, 2016 5:08 am 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 2161
HI,
your symlinc should be:

/dev/ttyCOM0 -> /dev/pts/0

then it will work.

BR
Edwin


Top
   
PostPosted: Fri Aug 26, 2016 8:19 am 
Offline

Joined: Thu Jul 21, 2016 2:48 pm
Posts: 7
Thank You, Edwin.
I used to try, but nothing worked. (ttyCOM0)
After Your comment I started to study the problem deeper and found out gateway was created later than the start CoDeSys.
The problem was fixed - it works great!
Decided July 30.


Top
   
PostPosted: Mon Apr 17, 2017 5:27 pm 
Offline

Joined: Thu Feb 16, 2017 3:39 pm
Posts: 8
hi,

Modbus RTU is bus-faillure(red) when i restart or turn on my rpi, i need to connect with Codesys development and download the app and run.

I made Create Boot App and Sourcecode download.

I tried,

IF Modbus_Slave_COM_Port.xError THEN
Modbus_Slave_COM_Port.xReset := TRUE;
END_IF

but this doesn't work only change to orange from red.

Thank you.


Last edited by HTejada on Mon Apr 17, 2017 6:18 pm, edited 1 time in total.

Top
   
PostPosted: Mon Apr 17, 2017 5:41 pm 
Offline

Joined: Tue Apr 05, 2016 12:36 pm
Posts: 12
Hi, I've two usb-serial devices from the same manufacturer. I've created udev rules to assing different names for both devices. Names are motor_up and motor_down. Both devices are listed in the /dev folder and both are working fine with minicom. I've added both devices to CODESYSControl.cfg:

[SysCom]
Linux.Devicefile=/dev/motor_up
portnum := COM.SysCom.SYS_COMPORT1;
Linux.Devicefile=/dev/motor_down
portnum := COM.SysCom.SYS_COMPORT2;

No way to make it work :( :(

I appreciate your uggestions..


Top
   
PostPosted: Mon Apr 17, 2017 5:49 pm 
Offline

Joined: Thu Feb 16, 2017 3:39 pm
Posts: 8
dosnova wrote:
Hi, I've two usb-serial devices from the same manufacturer. I've created udev rules to assing different names for both devices. Names are motor_up and motor_down. Both devices are listed in the /dev folder and both are working fine with minicom. I've added both devices to CODESYSControl.cfg:

[SysCom]
Linux.Devicefile=/dev/motor_up
portnum := COM.SysCom.SYS_COMPORT1;
Linux.Devicefile=/dev/motor_down
portnum := COM.SysCom.SYS_COMPORT2;

No way to make it work :( :(

I appreciate your uggestions..


You can try one by one, with codesys check. Can you show us result about this?


Top
   
PostPosted: Mon Apr 17, 2017 6:09 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 2161
Hi,

I would set symbolic links in Linux

/dev/motor_up -> /dev/ttyMotor0
/dev/motor_down-> /dev/ttyMotor1

and then in /etc/CODESYSControl.cfg only this line will be needed:

[SysCom]
Linux.Devicefile=/dev/ttyMotor

In CODESYS you'll then access com1 for Motor0(Motor_up) and com2 is Motor1(Motor down)

BR
Edwin


Top
   
PostPosted: Mon Apr 17, 2017 6:55 pm 
Offline

Joined: Tue Apr 05, 2016 12:36 pm
Posts: 12
Thanks Edwin, now it appears to be working. I've a new question... how to add a line feed + carriage return at the end of the string I am sendig to serial device??


Top
   
PostPosted: Mon Apr 17, 2017 7:08 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 2161
Hi,
$L and $R

BR
Edwin


Top
   
PostPosted: Mon Apr 17, 2017 7:21 pm 
Offline

Joined: Tue Apr 05, 2016 12:36 pm
Posts: 12
:D :D


Top
   
PostPosted: Tue Apr 18, 2017 9:42 am 
Offline

Joined: Thu Feb 16, 2017 3:39 pm
Posts: 8
I have a Modbus Com Error when i reboot my RPI. I share a video. Can you help me pls?

https://drive.google.com/open?id=0B92kE ... nZ2aFYxSms

BR
Hector


Top
   
PostPosted: Tue Apr 18, 2017 7:10 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 2161
Hi,
guess you need to set the autorestart flag?

BR
Edwin


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Wed Apr 19, 2017 9:11 am 
Offline

Joined: Thu Feb 16, 2017 3:39 pm
Posts: 8
Edwin Schwellinger wrote:
Hi,
guess you need to set the autorestart flag?

BR
Edwin


Thanks you Edwin,

I tried with autorestart flag too. (bad lucky :cry: )

I'm thinking in reset warm, but I don't know set autoplay after reset.

BR
Hector


Top
   
PostPosted: Wed Apr 19, 2017 2:55 pm 
Offline

Joined: Thu Apr 13, 2017 8:01 am
Posts: 16
Dear All,

This topic was so helpfull for me about getting data from usb via codesys.

I used, Edwin's example it works well. I can read data from my usb GPS receiver.

But, i wonder what if i have 2 usb device at the same time.
How we can control both of them at the same time ? It is possible to do it?

For example;
For one usb device we can use
FirstSerialLine(
slMode:= SL_READWRITE,
udiPort:= 1,
udiBaudrate:= 4800,
paParity:= COM.PARITY.NONE,
sbStopBits:= COM.STOPBIT.ONESTOPBIT,
udiByteSize := 8);

what we need to do for 2 usb device at the same time.

Thank you for your help.


Top
   
PostPosted: Wed Apr 19, 2017 3:18 pm 
Offline

Joined: Thu Feb 16, 2017 3:39 pm
Posts: 8
ekmekci wrote:
Dear All,

This topic was so helpfull for me about getting data from usb via codesys.

I used, Edwin's example it works well. I can read data from my usb GPS receiver.

But, i wonder what if i have 2 usb device at the same time.
How we can control both of them at the same time ? It is possible to do it?

For example;
For one usb device we can use
FirstSerialLine(
slMode:= SL_READWRITE,
udiPort:= 1,
udiBaudrate:= 4800,
paParity:= COM.PARITY.NONE,
sbStopBits:= COM.STOPBIT.ONESTOPBIT,
udiByteSize := 8);

what we need to do for 2 usb device at the same time.

Thank you for your help.


if 2 usb are the same manufacture, you can change udiport:=2 for second device. You can create news string i/o for the second device.

Lucky!

BR
Hector.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 81 posts ]  Go to page Previous 1 2 3 4 5 6 Next

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited