Hi guys , i have been playing with the plc 750-841 for a couple of month now, and your help was really helpfull. But now i am facing another question:
Is it possible to develop a POU that can act like a "C program", more precisely with the "MAIN" calling "Functions" for execution and return values using ST. Because i try to develop it but without any success and alot of error
I am not what you can called an experience programmer, and dont pretend to be one. but if you guys can give some inputs on how to achieve such POU structure that will help me ALOT..
Most likely i want the "MAIN" to call a define suit of action base on function while pre requirement are meet using a counter variable program as reference point for the main.
the MAIN shall react on those:
IF counter < 900 then (that is the maximum value that i want the counter to count too and is equal to 15 min, as the
counter PRG will run on a 1 second cycle.)
FOR counter := 0 to 299 by 1 do
temperature_value:=20.0; (configuring variable temperature_value to 20.0)
T_average; (calling the function T_average, that will get the temperature out of two PT100 and calculate their
average(can each PT100 have an acquisition function from wich the output can be call by the function TM??
if so how the declaration will look like, i read the manual explanation and simply dont understand it )
Regulating; (calling a function that will regulate the temperature by activating Digital Output according to the
"temperature_value" set value.)
Current_1; (calling function "Current_1" that is configure to calculate from word to Real of a transducer)
Current_2; (same as Current 1)
END_FOR
For Counter := 300 to 599 by 1 DO
temperature_value:= 25.5; ( configuring the variable now for a 25.5 value , The function above are being call again for
reacting on that new value of "temperature_value")
My main problem consist that as per my reading, in a Function, the Function name is also the output value variable, but how to set up the function in order for it to be activate from another function and program And how to implement in the MAIN to be able to achieve the goal wanted???
Regards
Lasrediel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well i found an alternative way to do what i was intending to do
I think my issue was regarding the fact that the function in itself dont retain any values. so i convert my project into PROGRAM instead of the function and all seems to work as intend.
Regards
Lasrediel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi guys , i have been playing with the plc 750-841 for a couple of month now, and your help was really helpfull. But now i am facing another question:
Is it possible to develop a POU that can act like a "C program", more precisely with the "MAIN" calling "Functions" for execution and return values using ST. Because i try to develop it but without any success and alot of error
I am not what you can called an experience programmer, and dont pretend to be one. but if you guys can give some inputs on how to achieve such POU structure that will help me ALOT..
Most likely i want the "MAIN" to call a define suit of action base on function while pre requirement are meet using a counter variable program as reference point for the main.
the MAIN shall react on those:
IF counter < 900 then (that is the maximum value that i want the counter to count too and is equal to 15 min, as the
counter PRG will run on a 1 second cycle.)
FOR counter := 0 to 299 by 1 do
temperature_value:=20.0; (configuring variable temperature_value to 20.0)
T_average; (calling the function T_average, that will get the temperature out of two PT100 and calculate their
average(can each PT100 have an acquisition function from wich the output can be call by the function TM??
if so how the declaration will look like, i read the manual explanation and simply dont understand it )
Regulating; (calling a function that will regulate the temperature by activating Digital Output according to the
"temperature_value" set value.)
Current_1; (calling function "Current_1" that is configure to calculate from word to Real of a transducer)
Current_2; (same as Current 1)
END_FOR
For Counter := 300 to 599 by 1 DO
temperature_value:= 25.5; ( configuring the variable now for a 25.5 value , The function above are being call again for
reacting on that new value of "temperature_value")
My main problem consist that as per my reading, in a Function, the Function name is also the output value variable, but how to set up the function in order for it to be activate from another function and program And how to implement in the MAIN to be able to achieve the goal wanted???
Regards
Lasrediel
Well i found an alternative way to do what i was intending to do
I think my issue was regarding the fact that the function in itself dont retain any values. so i convert my project into PROGRAM instead of the function and all seems to work as intend.
Regards
Lasrediel
in a function block you can use a lot of varoables.
for a start make all var global this is easier to work.
use FB programming.
when averaging two Pt100 values you can also use 4 Pt100 values and connect them in a bridge.
this way you only need one input.