Official Arduino Modbus RTU library and Controllino Mega

Post Reply
Uskok
Posts: 2
Joined: Wed Jul 24, 2019 8:36 am

Official Arduino Modbus RTU library and Controllino Mega

Post by Uskok » Wed Jul 24, 2019 9:17 am

Hi,

I have problem with official Arduino Modbus RTU library (https://www.arduino.cc/en/ArduinoModbus/ArduinoModbus)

Inside Library, at the end of the file RS485.cpp, instance of RS485 class is initialized.

Code: Select all

RS485Class RS485(SERIAL_PORT_HARDWARE, RS485_DEFAULT_TX_PIN, RS845_DEFAULT_DE_PIN, RS845_DEFAULT_RE_PIN);
This is not fit with hardware inside Controllino Maxi or Mega. I tried to change the initialization to

Code: Select all

RS485Class RS485(SERIAL_PORT_HARDWARE3, CONTROLLINO_UART_TX, CONTROLLINO_RS485_DE, CONTROLLINO_RS485_nRE);
But without success.

The tutorial and library from Controllino web site (https://www.controllino.biz/knowledge-b ... modbusrtu/) is working, but I would like to avoid mixing of two different libraries. We are already using official version Arduino Modbus TCP.

Has anyone encountered this problem and managed to solve it?
Thanks in advance,

Uskok

User avatar
Lukas
Posts: 34
Joined: Tue Dec 18, 2018 3:44 pm

Re: Official Arduino Modbus RTU library and Controllino Mega

Post by Lukas » Fri Aug 09, 2019 12:32 pm

Hi,

I think that you have done only one small mistake - please try to replace

Code: Select all

CONTROLLINO_UART_TX
with

Code: Select all

CONTROLLINO_RS485_TX
.

And it is also necessary to add

Code: Select all

#include <Controllino.h>
at the top of the RS485.cpp.

I will try to prepare the setup and test it here also.

Good luck!
Lukas

Uskok
Posts: 2
Joined: Wed Jul 24, 2019 8:36 am

Re: Official Arduino Modbus RTU library and Controllino Mega

Post by Uskok » Tue Aug 20, 2019 2:52 pm

Thanks, it is working.

Post Reply