sema

PLCopen motion icon

 Function BlockClosed A function block groups an algorithm and a set of private data. It has inputs and outputs. - Semaphore.

Inputs

Input

Data Type

Range

Unit

Default

Description

CLAIM

BOOL

 

 

 

Takes the semaphore.

RELEASE

BOOL

 

 

 

Releases the semaphore.

Outputs

Output

Data Type

Range

Unit

Description

BUSY

BOOL

 

 

TRUE if semaphore is busy.

Remarks

The functionClosed A function calculates a result according to the current value of its inputs. A function has no internal data and is not linked to declared instances. block implements this algorithm:

    BUSY := mem;
    if CLAIM then
       mem := TRUE;
    else if RELEASE then
       BUSY := FALSE;
       mem := FALSE;
    end_if;

FBD Language Example

FFLD Language Example

  • In the FFLD Language, the input rung is the CLAIM command.
    • The output rung is the BUSY output signal.

IL Language Example

(* MySema is a declared instance of SEMA function block *)
Op1: CAL MySema (CLAIM, RELEASE)
     FFLD  MyBlinker.BUSY
     ST  BUSY

ST Language Example

(* MySema is a declared instance of SEMA function block *)
MySema (CLAIM, RELEASE);
BUSY := MyBlinker.BUSY;