A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By engrkhawaja
#35910 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
User avatar
By frankDownunder
#38442 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 ?
User avatar
By anouar
#61567 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