FC_SemaphoreMeGive

 

FC_SemaphoreMeGive - General Information

Overview

Type:

Function

Available as of:

V1.0.7.0

Versions:

Current version

Task

Enable a Semaphore

Description

The function executes the Give() operation on the specified semaphore. Give() may only be executed by the task that possesses the semaphore or that executed Take().

If other tasks on the semaphore are blocked, the one with the highest priority is awakened. In the event that no tasks are waiting for the semaphore, the semaphore switches to the "full" state.

Accordingly, in cases in which a task with higher priority (Task2) than the task calling up Give() (Task1) is waiting for the semaphore, a task switch takes place. The execution of Task1 is paused and the execution of Task2 continues.

For restrictions for use see Notes on Using the "SemaphoreMutualExclusion" Function.

Interface

Output

Data type

Description

q_etDiag

GD.ET_Diag

General library-independent statement on the diagnostic.

A value not equal to ET_Diag.Ok corresponds to an diagnostic message.

q_etDiagExt

ET_DiagExt

POU-specific output on the diagnostic.

q_etDiag = ET_Diag.Ok -> Status message

q_etDiag <> ET_Diag.Ok -> Diagnostic message

Input/Output

Data type

Description

iq_stSemMe

ST_SemaphoreMe

Structure of the semaphores to be released

Return Value

Data type

Description

BOOL

TRUE: the semaphore has been successfully released.

FALSE: the semaphore has not been released.

Diagnostic Messages

q_etDiag

q_etDiagExt

Enumeration value

Description

OK

Ok

0

Ok

InputParameterInvalid

SemaphoreMeNotInitialized

266

SemaphoreMe is not initializd.

UnexpectedProgramBehavior

SemaphoreMeGiveFailed

271

Releasing the SemaphoreMe was unsuccessful.

Ok

Enumeration name:

Ok

Enumeration value:

0

Description:

Ok

The semaphore has been successfully released.

SemaphoreMeGiveFailed

Enumeration name:

SemaphoreMeGiveFailed

Enumeration value:

271

Description:

Releasing the SemaphoreMe was unsuccessful.

Issue

Cause

Solution

-

An error occurred in the internal execution.

Please inform the support team about this error.

SemaphoreMeNotInitialized

Enumeration name:

SemaphoreMeNotInitialized

Enumeration value:

266

Description:

SemaphoreMe is not initializd.

Issue

Cause

Solution

-

The semaphore is not initialized.

Transfer the same semaphore which was used during call-up of FC_SemaphoreMeCreate at the iq_stSemMe input.