CODESYS - the IEC 61131-3 automation software
https://forum.codesys.com/

Modbus RTU 485
https://forum.codesys.com/viewtopic.php?f=21&t=5956
Page 1 of 1

Author:  adc1994 [ Thu Nov 13, 2014 5:44 pm ]
Post subject:  Modbus RTU 485

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.

Author:  Edwin Schwellinger [ Thu Nov 13, 2014 5:53 pm ]
Post subject:  Re: Modbus RTU 485

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

Author:  adc1994 [ Thu Nov 13, 2014 6:05 pm ]
Post subject:  Re: Modbus RTU 485

These are my screens.
Thanks in advance :)

Author:  Edwin Schwellinger [ Thu Nov 13, 2014 6:06 pm ]
Post subject:  Re: Modbus RTU 485

type:

Modbus_Slave_COM_Port

to the watch window...
BR
Edwin

Author:  adc1994 [ Thu Nov 13, 2014 6:09 pm ]
Post subject:  Re: Modbus RTU 485

Done.
It seems like a wrong response comes from the slave...

Author:  Edwin Schwellinger [ Thu Nov 13, 2014 6:16 pm ]
Post subject:  Re: Modbus RTU 485

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

Author:  adc1994 [ Thu Nov 13, 2014 6:18 pm ]
Post subject:  Re: Modbus RTU 485

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.

Author:  Edwin Schwellinger [ Thu Nov 13, 2014 6:20 pm ]
Post subject:  Re: Modbus RTU 485

Hi,
is it possible to trace somehow the serial traffic?

BR
Edwin

Author:  adc1994 [ Sun Nov 16, 2014 4:16 pm ]
Post subject:  Re: Modbus RTU 485

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.

Page 1 of 1 All times are UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/