YvesDMG

Hello,
I recently discovered openPLC and am using it to automate and control my heathing system.
While I still lack experience with IEC1133 programming, I have the system with openPLC Editor, Runtime on Windows and Arduino and Modbus serial and TCP and ScadaBR running. It is a great and open system!

I found that it is possible and usefull to use an ESP8266 modbus slave (with the OpenPLC firmeare) without OpenPLC Runtime, directly as data point source for ScadaBR.
But I have an issue to add more than 1 digital input and output from the ESP8266 as datapoint in ScadaBR. The first datapoint works fine, but if I increase to offset to 1, 2 etc. the error "Illegal data address" occurs.
However, when adding datapoints via the Runtime system (Offset 800, 801 etc.) there is no error! There must be a difference in requesting Modbus data.

In Detail, adding datapoints in ScadaBR directly from the ESP8266 Modbus Slave:
Modbus Read Data for Coil- and Input Status:
- with offset 0 and Number of registers 8: works
- With offset 1 and Number of registers 1: "Illegal data address"

Point Locator Test for Coil- and Input Status:
- Offset 0, Registers 0 (fix): works
- Offset 1, Registers 0: "Illegal data address"

I this just a limitation of the Modbus firmware for the ESP8266 because only communication with the OpenPLC runtime is foreseen?
What is causing this behavior?
I there something I could do to fix the issue? Maybe extend the implementation or to use another Modbus Library?

Thank you for any hint.

Yves

Reply 0 0
YvesDMG

Hi
I fixed the issue for me in the modbus.h file of the OpenPLC_ESP8266_V3 firmware, a fist check with QModMaster was successfull.
In line 123 and 181:
- if (position < MAX_COILS + (Start % 8))
- if (position < MAX_DISCRETE_INPUT + (Start % 8))

However be aware, this change may have unexpected side effects, my understanding of Modbus stuff is still limited and I did not analyzed my problem in deep.
I believe with the fix does not cover offsets >7.

Yves

Reply 0 0
thiagoralves
The firmware was written most specifically to communicate with OpenPLC host. If you want to read data from your slave device on ScadaBR, point ScadaBR to your OpenPLC host, not the slave device itself.
Reply 0 0
YvesDMG

Thank you Thiago,
this is what I supposed, with the benefit of an efficient, lightwight implementation on the Arduino.
For me it is fine like it is. I like to be able to program Arduinos with OpenPLC and use them standalone or with an OpenPLC runtime host with lots of flexibiliy.
I did FBD and assembler programing for printing machines back in 1986 and love to get back into business for building automation in my home - thanks to OpenPLC.

BR, Yves

Reply 0 0
thiagoralves
If you want standalone arduinos you should check OpenPLC Editor v1.3 (the latest version on the website). It has support for a native Arduino runtime
Reply 0 0
YvesDMG

I already used the native Arduino runtime with success on an Arduino Uno. Very nice. My program runs 2 tasks, one executed with 10 seconds interval for DS18B20 sensing and the other on in 100ms intervals for mixing valve motor control (3 position, with open/close for 500ms) . I still did not managed to run the program on a ESP8266 D1, but did not analyzed yet.

Reply 0 0
Reply