TurpoUrpo
Lifetime Supporting Member
Hi
I did quick hacks for TP and TOF to get reset functions in them. Here is the source:
I looked into making also retentive timer types, but could not find where does ATIME get its value from, has anyone of you found it?
I made one version using SFC 6. And updating STIME while timer was "paused". But I dont think its good way to do it.
I did quick hacks for TP and TOF to get reset functions in them. Here is the source:
Code:
FUNCTION_BLOCK TPR
TITLE = Resettable Pulse Timer
VAR_INPUT
IN, R: BOOL;
PT : TIME;
END_VAR
VAR_OUTPUT
Q : BOOL;
ET : TIME;
END_VAR
VAR
STATE : BYTE;
R_Edge : BOOL;
STIME, ATIME : TIME;
END_VAR
BEGIN
NETWORK
TITLE =
A R;
FP R_Edge;
JCN nres;
L B#16#00;
T STATE;
nres: UC SFB 3;
END_FUNCTION_BLOCK
FUNCTION_BLOCK TOFR
TITLE = Resettable Off Delay TIMER
VAR_INPUT
IN, R: BOOL;
PT : TIME;
END_VAR
VAR_OUTPUT
Q : BOOL;
ET : TIME;
END_VAR
VAR
STATE : BYTE;
R_Edge : BOOL;
STIME, ATIME : TIME;
END_VAR
BEGIN
NETWORK
TITLE =
A R;
FP R_Edge;
JCN nres;
L B#16#00;
T STATE;
nres: UC SFB 5;
END_FUNCTION_BLOCK
I looked into making also retentive timer types, but could not find where does ATIME get its value from, has anyone of you found it?
I made one version using SFC 6. And updating STIME while timer was "paused". But I dont think its good way to do it.