CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Tue Aug 22, 2017 9:31 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 Apr 24, 2014 4:17 pm 
Offline
Site Admin

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

check this:

viewtopic.php?f=21&t=5713#p10314

this should work for modbus_rtu too (sure with the modbus serial fb too)

BR
Edwin


Top
   
PostPosted: Thu Apr 24, 2014 8:24 pm 
Offline

Joined: Fri Apr 18, 2014 5:36 pm
Posts: 69
Hi Edwin,

In this case Raspberry have to be Modbus master. Can we use the same FB here?

Best regards,
Zdenko


Top
   
PostPosted: Mon Jun 16, 2014 8:46 am 
Offline

Joined: Thu Mar 17, 2011 7:27 am
Posts: 3
Hello

I am trying to use Edwins project SerialComWithVisuRaspi.projectarchive.

I want to use the Pi’s internal serial port, I guess this is ttyAMA0.
Where can I allocate ttyAMA0 to the project. By now I am getting the message UNKNOWN_ERROR, and now data at the serial port.

Can anyone help me in the right direction here?

"Edit":
I se that I have used ttyAMA0 insted og ttyAMA in the config file /etc/CODESYSControl.cfg:
[SysCom]
Linux.Devicefile=/dev/ttyAMA
portnum := COM.SysCom.SYS_COMPORT1;


Data is now sendt from the Pi and CoDeSys. But it seems like the baudrate is wrong. Do I have to configure the baudrate also in the /etc/CODESYSControl.cfg file?


Top
   
PostPosted: Thu Jun 19, 2014 4:16 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 2059
Hi,
which baudrate are you using exactly?
there is a problem on baudrates <2400, this will be fixed in the next version..
coming with 3.5SP5 release which should be on July.

BR
Edwin


Top
   
PostPosted: Thu Aug 07, 2014 1:02 pm 
Offline

Joined: Fri Apr 18, 2014 5:36 pm
Posts: 69
Hi,

Is there a fix for auto reconnection on RS-485 after COM error in version 3.5.SP5?

Best regards,
Zdenko.


Top
   
PostPosted: Thu Aug 07, 2014 6:18 pm 
Offline
Site Admin

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

I would give a yes 'auto-restart communication'

BR
Edwin


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


Top
   
PostPosted: Fri Aug 08, 2014 8:13 am 
Offline

Joined: Fri Apr 18, 2014 5:36 pm
Posts: 69
Hi,

yes, it works :D !
Thank you Edwin.

Best regards,
Zdenko.


Top
   
PostPosted: Fri Aug 29, 2014 5:57 pm 
Offline

Joined: Tue Apr 01, 2014 10:52 pm
Posts: 5
Hello,

Edwin has described how to connect one serial device and it works well.

Edwin Schwellinger wrote:
this works already but you need to add your configuration:

1. you need to check on linux side which tty port is available.

For my tests I've used a USB to serial converter:
Check under Linux with 'dmesg' which port is used:

in my case it reports: ttyUSB0

so you need to add in /etc/CODESYSControl.cfg
(Attention you need to remove the 0 from USB0)

[SysCom]
Linux.Devicefile=/dev/ttyUSB
portnum := COM.SysCom.SYS_COMPORT1;

this was the pi side under Linux

2. then after reboot or restart plc, you could communicate via serial com from your IEC application

What I have to do to connect a second serial device in parallel ?
If I plug the second device then it known (using dmesg) as ttyUSB1.
How the changes in the CODESYSControl.cfg looks like to use two Serial devices in paralell ?

Thank you for your Support !


Top
   
PostPosted: Tue Sep 02, 2014 12:46 pm 
Offline

Joined: Fri Apr 18, 2014 5:36 pm
Posts: 69
Hi,

I have a same question - how can I use two Serial devices in parallel (with USB-serial adapter)?

Thank you!

Best regards,
Zdenko.


Top
   
PostPosted: Tue Sep 02, 2014 1:14 pm 
Offline
Site Admin

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

it should work if you have for example two adapters of the same manufacturer
then you get USB0 and USB1 for example which then lead to com1 and com2 in CODESYYS, but if you have two different like for example
USB0 should be your com1 and tty2 your com2:

I would give the following a try:

Use the settings as done in my description,
then make a symlink under Linux to the next serial Interface. (in that example from tty2 to USB1)


BR
Edwin


Top
   
PostPosted: Tue Sep 02, 2014 2:25 pm 
Offline

Joined: Fri Apr 18, 2014 5:36 pm
Posts: 69
Hello,

I have tested 2 serial adapters, connected on the same time. They are from different manufacturer, but I still get USB0 and USB1 on Raspberry.
I made nothing more than described in Edwin’s description:
Code:
[SysCom]
Linux.Devicefile=/dev/ttyUSB
portnum := COM.SysCom.SYS_COMPORT1;

And it works on COM1 and COM2 in Codesys.

But there is another question:
For example:
-we have 2 adapters connected.
-first one on Raspberry USB socket 1 and second one on Raspberry USB socket 2.
-first one will be ttyUSB0, which is COM1 in Codesys, second one is ttyUSB1, which is COM2 in Codesys.
-if we disconnect first adapter or it has a fault, the second one will become ttyUSB0 - COM1 in Codesys, which is wrong.
How can we fix specific USB/serial adapter to specific COM in Codesys, that first adapter will always be COM1 and second one will always be COM2?


Best regards,
Zdenko.


Top
   
PostPosted: Mon Sep 08, 2014 4:07 pm 
Offline
Site Admin

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

please google for udev rules raspberry pi,
guess this should show you, how you could link a specific device to always the same device
maybe links like:
http://superuser.com/questions/536478/h ... -addresses
could help on this issue.

BR
Edwin


Top
   
PostPosted: Tue Sep 09, 2014 6:32 pm 
Offline

Joined: Fri Apr 18, 2014 5:36 pm
Posts: 69
Hi Edwin,

Thank you very much. I will try this asap.

Best regards,
Zdenko.


Top
   
PostPosted: Sat Oct 25, 2014 9:13 pm 
Offline

Joined: Tue Oct 14, 2014 8:40 pm
Posts: 3
Hello Edwin,

I tried to use your project "SerialComWithVisu.project" with one USB to serial cable but It doesn't work.
My Codesys release is V3.5 SP5 patch 2 and on Raspberry it's 2.0.1.0

I have the error ERROR_UNKNOW.--> I set :
udiPort:= 0,
udiBaudrate:= 9600,
paParity:= COM.PARITY.NONE,
sbStopBits:= COM.STOPBIT.ONESTOPBIT,
udiByteSize := 8 );

I tested my connection directly from the Raspberry with Minicom (thru dev/ttyUSB0) and it was working perfectly (emission & reception).
my baudrate is 9600bds.

I checked on the CODESYScontrol.cfg but the [SYSCOM] § doesn't exist !!!

Do you have an idea about what's wrong ?

Thank you for your help

Christian


Top
   
PostPosted: Sat Oct 25, 2014 9:23 pm 
Offline
Site Admin

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

you need to add the comport device depending on your used connection ( USB / TTY / whatever )
in /etc/CODESYSControl.cfg please add manually

[SysCom]
Linux.Devicefile=/dev/ttyUSB


according to your used interface /ttyAMS .... /tty ...

Regards
Edwin


Last edited by Edwin Schwellinger on Tue Apr 18, 2017 5:59 am, edited 1 time in total.

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 2 guests


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