用作带有置位和复位输入的继电器
KEEP用作带有置位和复位点的触发器。
当SetTrigger变为TRUE时,指定的标志变为TRUE且保持其状态。当ResetTrigger变为TRUE时,标志变为FALSE。无论SetTrigger的状态为TRUE还是FALSE,都会保持标志的TRUE状态,直到ResetTrigger变为TRUE。如果SetTrigger和ResetTrigger同时变为TRUE,则ResetTrigger具有优先级。
输入
将Address变为TRUE
将Address变为FALSE
输出
此标志的状态(TRUE或FALSE)保持不变。
所有用于编程此函数的输入和输出变量已在POU头中声明。 所有编程语言使用相同的POU头。
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 *) |