-->
Page 1 of 2

Porting MODBUS RTU Library from AVR to ESP8266

PostPosted: Mon Dec 07, 2015 4:28 pm
by engrkhawaja
Hi,

I am trying to port this library to ESP8266 12
https://github.com/smarmengol/Modbus-Ma ... or-Arduino

I have issue with porting uart functions.

These two commands to ESP8266.

while (!(UCSR0A & (1 << TXC0)));

UCSR0A=UCSR0A |(1 << TXC0);

Is there any other adjustment required to run the library?

Can you please help me a bit.
Thanks

Re: Porting MODBUS RTU Library from AVR to ESP8266

PostPosted: Sun Jan 10, 2016 3:22 pm
by frankDownunder
Hi engrkhawaja ,
Those two commands get the Arduino to wait until the transmission to complete. Otherwise you can clear the enable pin too early. See my post on this thread here:
viewtopic.php?f=6&t=7487
"RS485 - WAITING FOR TRANSMISSION TO COMPLETE"

However I confess to not understanding the reply I got - still trying to work it out.
But since I am relaxed about occasional packet loss, I might just stick with a short wait and hope that the timing is OK.

How did you go - did you have any success with Modbus / RS485 ?

Re: Porting MODBUS RTU Library from AVR to ESP8266

PostPosted: Tue Aug 09, 2016 4:12 am
by finchen510
Hi engrkhawaja ,
can you show the code you wrote or the changes you do on the library.
I want to use Modbus rtu with an esp8266- 01

Re: Porting MODBUS RTU Library from AVR to ESP8266

PostPosted: Thu Jan 26, 2017 8:57 am
by anouar
hello
i need help for modbus TCP/IP-RTU RS232/RS485 when i using ESP8266 beacause i have downloading the code in this link:
https://github.com/JhonControl/Arduino_ ... aveTCP-RTU

but he didn't function RTU except modbus TCP/IP i don't know why ?
when i try use (simple_slave.ino) he give me this error
Arduino:1.6.12 (Windows 10), Scheda:"Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None"

In file included from C:\Users\Anouar\Downloads\Arduino_ESP8266_Modbus_Industrial_Applications-master\Arduino_ESP8266_ Modbus_Industrial_Applications\3. ESP8266BridgeMBSlaveTCP-RTU\Library Modbus RTU\Modbus\examples\simple_slave\simple_slave.ino:10:0:

C:\Program Files (x86)\Arduino\libraries\Modbus/ModbusRtu.h: In member function 'void Modbus::sendTxBuffer()':

C:\Program Files (x86)\Arduino\libraries\Modbus/ModbusRtu.h:740:7: error: 'UCSR0A' was not declared in this scope

UCSR0A=UCSR0A |(1 << TXC0);

^

C:\Program Files (x86)\Arduino\libraries\Modbus/ModbusRtu.h:740:28: error: 'TXC0' was not declared in this scope

UCSR0A=UCSR0A |(1 << TXC0);

^

C:\Program Files (x86)\Arduino\libraries\Modbus/ModbusRtu.h:771:16: error: 'UCSR0A' was not declared in this scope

while (!(UCSR0A & (1 << TXC0)));

^

C:\Program Files (x86)\Arduino\libraries\Modbus/ModbusRtu.h:771:31: error: 'TXC0' was not declared in this scope

while (!(UCSR0A & (1 << TXC0)));

^

exit status 1
Errore durante la compilazione per la scheda Generic ESP8266 Module.



can you help me?
Thank you in advance