Serve da flag con gli ingressi di impostazione e di reset
KEEP serve da flip-flop con i punti di impostazione e di reset.
Se SetTrigger passa a TRUE, il flag specificato passa a TRUE e mantiene la sua condizione. Il flag passa a FALSE quando ResetTrigger passa a TRUE. Lo stato TRUE del flag viene mantenuto fino a quando ResetTrigger passa a TRUE indipendentemente dallo stato TRUE o FALSE di SetTrigger. Se SetTrigger e ResetTrigger passano a TRUE simultaneamente, la priorità viene data a ResetTrigger.
Ingresso
Imposta Address su TRUE
Imposta Address su FALSE
Uscita
Lo stato di questo flag (TRUE o FALSE) viene mantenuto.
Tutte le variabili di ingresso e uscita utilizzate per programmare questa funzione sono state dichiarate nell'intestazione del POU.La stessa intestazione del POU è utilizzata per tutti i linguaggi di programmazione.
VAR
SetTrigger1: BOOL:=FALSE;
(*if SetTrigger1 is ON, the output Address1 will turn ON*)
ResetTrigger1: BOOL:=FALSE;
(*if reset_trigger is ON, the
Address1 will turn OFF*)
Address1: BOOL:=FALSE;
END_VAR
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_F,KEEP!,Instance,13,1,23,5,,?DSetTrigger?DResetTrigger?CAddress);
B(B_VAROUT,,Address1,23,2,25,4,);
B(B_CONTACT,,ResetTrigger1,5,3,7,5,);
B(B_CONTACT,,SetTrigger1,5,1,7,3,);
L(1,4,5,4);
L(1,2,5,2);
L(7,2,12,2);
L(12,2,12,3);
L(7,4,13,4);
L(12,3,13,3);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
Address1:=KEEP(SetTrigger1, ResetTrigger1);
LD |
SetTrigger1 |
(* load the value for the SetTrigger-Input *) |
KEEP |
ResetTrigger1 |
(* load the value for the ResetTrigger-Input and execute KEEP *) |
ST |
Address1 |
(* store the Address-Output value *) |