MODBUS comms query

For general Flowcode discussion that does not belong in the other sections.
Post Reply
RGV250
Posts: 264
http://meble-kuchenne.info.pl
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 23 times
Been thanked: 30 times

MODBUS comms query

Post by RGV250 »

Hi,
I am not sure if this is possible so just throwing it out there.
I have an industrial HMI which I can read data from the PLC's controlling my lighting. In the PLC all the registers have a MODBUS address so it is simple to just read the registers I need.
I am using a Raspberry Pi to read envoironmental things like temperature, humidity and power and thought it would be good if i could display these on the HMI.
I can see 2 issues here.
The HMI needs to read the data and here is the first issue, is it possible to create a variable (or array) and give it an address so the HMI can simply fetch it.
I have found the MODBUS TCP slave example but it seems like that is going to be a lot of work as each has to be processed individually, I may have 50 or so values. What I am hoping for is something where the registers can just be read without any extra code like what happens in the PLC.

Bob

Steve-Matrix
Matrix Staff
Posts: 1253
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: MODBUS comms query

Post by Steve-Matrix »

Hi Bob. I'm not very familiar with MODBUS, so this may not be correct. But hopefully it will help. And if not then maybe others on this forum with more MODBUS experience will contribute.

Looking at the slave component, you should be able to set 50 consecutive Analog Input values and set these values within your program using SetAnalogInput. Your program will also need to call CheckForIncoming regularly. This should automatically reply with the correct value if your HMI is set to ask for that address.

Post Reply