So if I call a function like this: GetParamByName('Device', 'Uptime'); it outputs the value of that parameter.
I think accessing parameters in a indexed, structured way must be elementary, but I'm kind of stuck in the process of how to do this 'the right way'
Shortly speaking, I want to access my variables through ethernet, so if I for example send a packet to the plc, give me a list of all parameters, it outputs all parameter groups/names.
Any suggestions/ideas? Is there a complete library for this available?
Best regards,
Frank[quote][/quote]
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Use structures. Then you can create functions to set/get the data.
Example:
TYPE Device :
STRUCT
Uptime :TIME;TimeNow :TIME;DateNow :DATE;
END_STRUCT
END_TYPE
Now in your program create a variable:
Pump1 : Device ;
Now access the data in the structure by using the dot operator:
Pump1.Uptime;
If you want to abstract the details like on a fault of the pump and you want to set some information then create a function Set_Pump_Fault_Time.
In the Set_Pump_Fault_Time function pass the structure. Then internally set the variables of the structure so the user doesn't need to know what it is doing.
If you need more details etc... or don't understand you I am referring to just ask and I can create a simple app for you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Rewritten my question...
PS: Using Wago 750-841 with no target parameter manager support.
I have a great deal of FB instances whitch of course include variables. How can I organize those variables (parameters) like in this example:
So if I call a function like this: GetParamByName('Device', 'Uptime'); it outputs the value of that parameter.
I think accessing parameters in a indexed, structured way must be elementary, but I'm kind of stuck in the process of how to do this 'the right way'
Shortly speaking, I want to access my variables through ethernet, so if I for example send a packet to the plc, give me a list of all parameters, it outputs all parameter groups/names.
Any suggestions/ideas? Is there a complete library for this available?
Best regards,
Frank[quote][/quote]
Use structures. Then you can create functions to set/get the data.
Example:
TYPE Device :
STRUCT
END_STRUCT
END_TYPE
Now in your program create a variable:
Pump1 : Device ;
Now access the data in the structure by using the dot operator:
Pump1.Uptime;
If you want to abstract the details like on a fault of the pump and you want to set some information then create a function Set_Pump_Fault_Time.
In the Set_Pump_Fault_Time function pass the structure. Then internally set the variables of the structure so the user doesn't need to know what it is doing.
If you need more details etc... or don't understand you I am referring to just ask and I can create a simple app for you.