ModBus addresses, MAP transformation

Hi guys, first post here, bear with me :sweat_smile:
What I’d like to do is to automate the address changing to my Modbus things because every time I made a little modification to my PLC program it spew out the variable in different addresses…
My idea is to use a map services to transform the name of ModBus things to their addresses…
Is this even possible?? :thinking:
Somthing like this:
Thing data ac_setpoint_0 [ readValueType="int16", readStart="[MAP(]", readTransform="default", writeMaxTries=3, writeType="holding", writeValueType="int16", writeStart="[MAP(]", writeTransform="default", updateUnchangedValuesEveryMillis=6000 ]

Were in the I have:

If you have any idea how to achieve that, I would highly appriciate!
Thank you!!


It’s hard to see any justification to develop such a feature, I’ve never come across any other modbus device that doesn’t use fixed register addresses.

Why not write your PLC program to use fixed addresses?

You are right @rossko57… but the PLC I’m working on is a bit sketchy…
Every time I modify the program in the PLC it changes the mapping of the address->variable…
It’s an annoing thing I’ve already mentioned to the manufacturer in the hope for a bug fix (there is a function to statically create the map but it’s not working…), and in the meantime i’d like to non drive myself crazy :yum:
Maybe generating an intermediate file as a markup/markdown and post process it…
Have you got any advice??

Well if you configure your Modbus Things with a file, you could edit your file with search and replace. Take care to only change the correct things.
I suppose if you were clever, you could create a “blank” template/form and have some script that automated filling in blanks with consecutive numbers from a seed number.

1 Like

I wrote myself a little python script to do this “insert data”, solved :+1:

Thank you!!