I have 16 modbus slaves which have an idiotic modbus register layout, so I can't do 1 single query for several registers, but 1 query for each register I want.
This means I have to do a lot of manual mapping on the function block for the devices, usually I have 2 variables per device like this, which are mapped to the modbus data:
VAR_INPUT awDataIn : ARRAY[0..20] OF WORD; END_VARVAR_OUTPUT awDataOut : ARRAY[0..5] OF WORD;END_VAR
And the arrays are mapped internally in the function block.
Since I cant do this with the stupid modbus slaves, I was thinking I could pass the modbus struct directly to the function block instead, however, each modbus device will have their own struct (typPump_1_tcp, typPump_2_tcp etc...), but with the same content. These structs are created automatically in e!cockpit by the modbus configurator.
How can I have an "universal" input on my function block and do some sort of type coercion on the modbus structs?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
I have 16 modbus slaves which have an idiotic modbus register layout, so I can't do 1 single query for several registers, but 1 query for each register I want.
This means I have to do a lot of manual mapping on the function block for the devices, usually I have 2 variables per device like this, which are mapped to the modbus data:
And the arrays are mapped internally in the function block.
Since I cant do this with the stupid modbus slaves, I was thinking I could pass the modbus struct directly to the function block instead, however, each modbus device will have their own struct (typPump_1_tcp, typPump_2_tcp etc...), but with the same content. These structs are created automatically in e!cockpit by the modbus configurator.
How can I have an "universal" input on my function block and do some sort of type coercion on the modbus structs?