CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Sat Dec 14, 2019 5:49 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Modbus RTU 485
PostPosted: Thu Nov 13, 2014 5:44 pm 
Offline

Joined: Fri Oct 17, 2014 11:57 am
Posts: 5
Hi everybody,
i am working on a MODBUS RTU over rs485 line system; the master device is my Raspberry PI, and the slave is an Arduino UNO with the simple-modbus-slave firmware.
I am going crazy trying to get this to work, i have tried everything: the MODBUS slave device on codesys shows the "Not running" error, while the arduino "rx" and "tx" pins are enabled and blinking, showing the master's request, followed by the slave's response.
Any ideas?
Thanks in advance.


Top
   
 Post subject: Re: Modbus RTU 485
PostPosted: Thu Nov 13, 2014 5:53 pm 
Offline
Site Admin

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

you mean you have configured / mapped your serial port in that way that codesys could use it?
The only point seems that the master does not recognize the slave reposonse in the watch window (see my screenshot)?

BR
Edwin


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


Top
   
 Post subject: Re: Modbus RTU 485
PostPosted: Thu Nov 13, 2014 6:05 pm 
Offline

Joined: Fri Oct 17, 2014 11:57 am
Posts: 5
These are my screens.
Thanks in advance :)


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


Top
   
 Post subject: Re: Modbus RTU 485
PostPosted: Thu Nov 13, 2014 6:06 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 3570
type:

Modbus_Slave_COM_Port

to the watch window...
BR
Edwin


Top
   
 Post subject: Re: Modbus RTU 485
PostPosted: Thu Nov 13, 2014 6:09 pm 
Offline

Joined: Fri Oct 17, 2014 11:57 am
Posts: 5
Done.
It seems like a wrong response comes from the slave...


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


Top
   
 Post subject: Re: Modbus RTU 485
PostPosted: Thu Nov 13, 2014 6:16 pm 
Offline
Site Admin

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

look like CODESYS get data from the wrong slave (at lease think it gets the wrong data)
does your address fit to your slave?

BR
Edwin


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


Top
   
 Post subject: Re: Modbus RTU 485
PostPosted: Thu Nov 13, 2014 6:18 pm 
Offline

Joined: Fri Oct 17, 2014 11:57 am
Posts: 5
Yes. The Arduino's slave id is 2 , and the slave id set in codesys is 2.
And the rx and tx leds on the slave flash correctly.


Top
   
 Post subject: Re: Modbus RTU 485
PostPosted: Thu Nov 13, 2014 6:20 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 3570
Hi,
is it possible to trace somehow the serial traffic?

BR
Edwin


Top
   
 Post subject: Re: Modbus RTU 485
PostPosted: Sun Nov 16, 2014 4:16 pm 
Offline

Joined: Fri Oct 17, 2014 11:57 am
Posts: 5
Everything works like a charm now.
I set parity to 8 data bits, EVEN, 1 stop bit.

It works both on a prolific usb-ttl + max485 converter/transceiver, and on the raspicomm board.
I am polling data @20ms interval.

Thanks for your help.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 9 posts ] 

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