tatayet
Hello, I have a regulation whose access is done in modbusavec arduino. I use openPLC_uno.
I would like to directly access variables rather than using modbus. Hreg
for example spedd = modbus[index]
is possible
thank you
Reply 0 0
thiagoralves
What do you mean by directly access variables?
Reply 0 0
tatayet
Hello Thiago
thank you for your answer.
To avoid making a loop to keep modbus data up to date, I would like to access the registers directly. I use modbus.Hreg (holding register modbud 3 or 6) to have read or write access. My device is a pwm output regulation and pt1000 probes. I want to be able to change the regulation parameters and view the parameters in real time via modbus.
Thank you for your design work, it is for me very precious tools.
Tatayet.
Reply 0 0
thiagoralves
You don’t have to design a loop or anything like that. OpenPLC already does that for you. All you have to do is add your slave device. Modbus data will always be up to date on OpenPLC
Reply 0 0
tatayet
I dont' use OpenPLC software, only your software on arduino.  In my design all modbus device are standalone.  an rasbpery send command or read info on the bus. 
Reply 0 0
thiagoralves
My software is OpenPLC. If you are not using my software then I can’t help you
Reply 0 0
tatayet
Hi Thiago,
Thank you.
It looks like your software downloaded here: https://github.com/thiagoralves/OpenPLC_Files/blob/master/Firmware/OpenPLC_Uno_v3.zip?raw=true
tanks.
Reply 0 0
thiagoralves
Exactly, that’s the OpenPLC slave device firmware for the Arduino Uno. It must be used in conjunction with the OpenPLC runtime. If you use them both together, there is no loop or anything else you need to worry. You can simply access all variables directly from OpenPLC runtime as local variables
Reply 0 0
YvesDMG

Hi tatayet,

provided that you are using openPLC runtime on Arduino, to be able to view parameters and change them via modbus you may define them as digital respectively analog outputs in openplc. Set the desired default parameter as initial value.
This worked for me with wemos D1 ESP8266 Arduino.

Reply 0 0
tatayet
Hello, I’ve given up the idea of using openplc. I can’t program object-oriented. I now use the SimpleModbusSlave library which is not object oriented. It works perfectly, I only have access to the 16bits registry but that’s enough for me.
Reply 0 0
Reply