10451 questions

12453 answers

19379 comments

21870 members

0 votes
179 views 0 comments
by

Hi,

I am using TRB245 as ModbusTCP master to read 3 register values from a PLC. i.e., Read holding register, with first register at 1, and register count of 3. I got a reading of three values from the PLC, i.e. 22,23,0

When I use Data to Server service with MQTT protocol, I need to send these three values individually in the following format to a IoT cloud platform: 

{"data": {"key": value, "key": value, "key": value } }

i.e., {"data": {"VR1": 22, "VR2": 23, "VR3": 0 } }

As register data (JSON object) - %a can only produce 22,23,0 in a serial of 3 numbers (an array?)

How can I get access to the individual value of the array of %a of TRB245?

I have tried %a[0] for the first value of %a; it was not working for me.

Please help.

Thanks.

1 Answer

0 votes
by

Hello,

In your case, you would need to create 3 data to server instances and set Data filtering option By slave ID and specify the ID of the slave:

Regards.