Due compatible modbus slave on RS485

Hi. Does anyone have a decent modbus slave library compatible with Arduino Due. I need at least functions 03 and 16. The interface is RS485 (using MAX485 ic). Also must be compatible with 8N1 port configuration.

Thank You

I don't know a Library for an RS485 communication, but I guess you should start with an USARTx RS232 implementation as a starting point, enable the RTS pin, note that the behavior of the RTS pin is controlled by the TXEMPTY bit. Therefore you will have somewhere in your code (e.g. with USART1):

//Wait for transmission to complete

The USART is set in RS485 mode by programming the USART_MODE field in the Mode Register (US_MR) to the value US_MR_USART_MODE_RS485.

And look over section 35.7.6 page 801 of Sam3x datasheet.

If you search for SimpleModbusSlave library, there is a version for DUE.
It seems to work reliably and I have not had any issues with it for the past year or two.

For my solar system, I have a DUE set up as Modbus RTU slave, using SimpleModbusSlave_DUE, being polled by a small GNU/Linux board which runs Modbus RTU master, using Libmodbus, which is a library for GNU/Linux systems.

You will find a thread in Networking, Protocols and Devices: this thread Help with ModBus RTU Master-Slave: SimpleModbus [SOLVED] - Networking, Protocols, and Devices - Arduino Forum
Search in there and you should find the link to get the DUE version of the library.
I don't have the actual link to the library source unfortunately, but do have the library.

Essentially, there is little difference between what interface you use.
The only thing that is needed for TIA-485 is the data direction control line if you are using half duplex.
I use it over USB as a serial device.

Paul - VK7KPA

I couldn't help myself, I found it at the following link:

Hover over the file names and you will see which one is for DUE.
You have slave or master for DUE.

Also, very importantly, make sure you read the documentation file before asking questions, as everything is fairly well explained in the documentation PDF.

Paul - VK7KPA