3 sema, Sema, Drive plc developer studio – Lenze DDS v2.3 User Manual

Page 303

Advertising
background image

Drive PLC Developer Studio

IEC 61131-3 Standard functions

14-11

l

DDS EN 2.3

14.4.3

SEMA

Software semaphore (interruptible)

X

is an internal BOOL variable initialized with FALSE .

BUSY

, CLAIM and RELEASE are of type BOOL.

If SEMA is called and BUSY is TRUE, SEMA has already been assigned
(SEMA was called using CLAIM = TRUE).

If BUSY is FALSE, SEMA has either not been called yet or been enabled
(call with RELEASE = TRUE).

BUSY = SEMA(CLAIM, RELEASE)

means:

BUSY:=X;
IF CLAIM THEN X:=TRUE;
ELSIF RELEASE THEN BUSY:=FALSE; X:=FALSE;
END_IF

Examples
Declaration:

SEMAInst : SEMA;

IL

FBD

CAL SEMAInst(CLAIM:=VarBOOL1, RELEASE:=VarBOOL2)
LD SEMAInst.BUSY
ST VarBOOL3

ST

SEMAInst(CLAIM:=VarBOOL1, RELEASE:=VarBOOL2);
VarBOOL3:=SEMAInst.BUSY;

Show/Hide Bookmarks

Advertising