paps
Üye
- Katılım
- 24 Mar 2010
- Mesajlar
- 19
- Puanları
- 1
- Yaş
- 41
Eğer FB içinde timer ihtiyacınız varsa ve programınızı realtime kullanıyorsanız (örn: OB32 bloğunu 100ms cycle frequency of execute ile kullanırsanız) aşağıdakini kullanabilirsiniz...
Function_Block FBXXXX
var_input
active : bool;
OB_CycleExecuteFrequency : int;
PT:int;
reset : bool;
end_var
var_output
output : bool ;
end_var
var
timerTempValue : int;
end_var
if(PT<timerTempValue AND active) then
timerTempValue:= timerTempValue+ CycleExecuteFrequency;
else
output := true;
timerTempValue:= 0;
end_var
if(active =false OR reset) then
output := false;
timerTempValue:= 0;
end_var
End_Function_block
Eğer FC de kullanmak isterseniz timerValue ve output değişkenini DB de tutmanız gerekir...
Faydalı olması dileğiyle
Function_Block FBXXXX
var_input
active : bool;
OB_CycleExecuteFrequency : int;
PT:int;
reset : bool;
end_var
var_output
output : bool ;
end_var
var
timerTempValue : int;
end_var
if(PT<timerTempValue AND active) then
timerTempValue:= timerTempValue+ CycleExecuteFrequency;
else
output := true;
timerTempValue:= 0;
end_var
if(active =false OR reset) then
output := false;
timerTempValue:= 0;
end_var
End_Function_block
Eğer FC de kullanmak isterseniz timerValue ve output değişkenini DB de tutmanız gerekir...
Faydalı olması dileğiyle