Page 2 of 3
Re: ESP32 MODBUS ASCII
Posted: Mon Apr 19, 2021 12:02 pm
by pedrazzi
I am building a slave object and to test it I use a MB master SW from PC, I have not tried to use another card in master configuration, but I do not think this is the problem ..
As I have already shown I can simply send a message composed correctly by the terminal, but the slave does not respond.
In addition it does not even enter in RX "CheckForIncoming" ...
Re: ESP32 MODBUS ASCII
Posted: Mon Apr 19, 2021 1:03 pm
by BenR
Hello,
I've had another look at your program for you, you shouldn't need to use the ChangeBaud command as the properties are configuring the baud rate for you to 9600.
I can't see any other problems other then you are using the digital inputs and these are usually inputs to the modbus slave which are then send out but you seem to be using them the other way and so using coils might make more sense.
Can we see your PC side of the communications to double check that this matches? A screen shot of the software might be good enough to see what's going on.
Re: ESP32 MODBUS ASCII
Posted: Mon Apr 19, 2021 2:26 pm
by pedrazzi
here is the program, practically the same as the example from which I removed the LEDs, and a photo of the message sent to which no response follows.
Re: ESP32 MODBUS ASCII
Posted: Mon Apr 19, 2021 2:31 pm
by pedrazzi
even this has no answer
Re: ESP32 MODBUS ASCII
Posted: Mon Apr 19, 2021 2:47 pm
by BenR
Are you sure it's MODbus ASCII the PC application is using?
The default is usually Modbus RTU and looking at the data it does seem to be RTU.

- ModbusType.jpg (10.11 KiB) Viewed 7159 times
Re: ESP32 MODBUS ASCII
Posted: Mon Apr 19, 2021 2:50 pm
by pedrazzi
unfortunately the request is ASCII, I tried to compile RTU (for test), but the result does not change ..
Re: ESP32 MODBUS ASCII
Posted: Mon Apr 19, 2021 2:53 pm
by pedrazzi
the project I attached in the post with the two photos is the one I use (ASCII)
Re: ESP32 MODBUS ASCII
Posted: Mon Apr 19, 2021 5:09 pm
by BenR
Hello,
Yes sorry I see now you're right it is ASCII mode data.
I have been back through the component and beleive I may have fixed a significant bug in the way ASCII data is sent and received. Fingers crossed that helps your situation and gets it working for you.
Re: ESP32 MODBUS ASCII
Posted: Mon Apr 19, 2021 6:26 pm
by pedrazzi
I added a check on the error in reception "255", but this is also ignored ..
Re: ESP32 MODBUS ASCII
Posted: Mon Apr 19, 2021 11:18 pm
by BenR
Hello again,
I've done a lot of testing now and found some more problems with the ASCII mode which have hopefully now been resolved for you. It's now working correctly for me with Flowcode as the master and the slave. I've also tried with some third party software to double check I have everything correct and so far these tests have also been very positive.
FIngers crossed and let me know how you get on.