KEEP

Serves as a relay with set and reset inputs

KEEP serves as a flip-flop with set and reset points.

When SetTrigger turns to TRUE, the specified flag turns to TRUE and maintains its condition. The flag turns to FALSE when ResetTrigger turns to TRUE. The flag's TRUE state is maintained until ResetTrigger turns to TRUE regardless of the TRUE or FALSE state of SetTrigger. If SetTrigger and ResetTrigger turn to TRUE simultaneously, priority is given to ResetTrigger.

Parameters

Input

Set Trigger (BOOL)

Turns Address to TRUE

Reset Trigger (BOOL)

Turns Address to FALSE

Output

Address (BOOL)

The status of this flag (TRUE or FALSE) is kept.

Example

POU header

All input and output variables used for programming this function have been declared in the POU header.The same POU header is used for all programming languages.

	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

LD body

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

ST body

Address1:=KEEP(SetTrigger1, ResetTrigger1);

IL body

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 *)

Modified on: 2019-01-24Feedback on this pagePanasonic hotline