L-force | plc designer – Lenze PLC Designer PLC Designer (R2-x) User Manual

Page 650

Advertising
background image

L-force | PLC Designer

PLC Designer Libraries

648

DMS 3.2 EN 02/2011 TD29



SEMA

Provided by standard.lib.

A Software Semaphore (Interruptible)

BUSY = SEMA(CLAIM, RELEASE) means:

BUSY := X;

IF CLAIM THEN X:=TRUE;

ELSE IF RELEASE THEN BUSY := FALSE; X:= FALSE;

END_IF

X is an internal BOOL variable that is FALSE when it is initialized.
The input variables CLAIM and RELEASE as well as the output variable BUSY are type
BOOL.

If BUSY is TRUE when SEMA is called up, this means that a value has already been
assigned to SEMA (SEMA was called up with CLAIM = TRUE). If BUSY is FALSE, SEMA
has not yet been called up or it has been released (called up with RELEASE = TRUE).

Declaration example:

SEMAInst : SEMA ;

Example in IL:

CAL SEMAInst(CLAIM:=VarBOOL1,RELEASE:=VarBOOL2)

LD SEMAInst.BUSY

ST VarBOOL3

Example in FBD:

Example in ST:

SEMAInst(CLAIM:= VarBOOL1 , RELEASE:=VarBOOL2 );

VarBOOL3 := SEMAInst.BUSY;

Advertising