SIGN block

Short summary

Name

SIGN

→POU type

→function

Category

IEC-block, NumericEnh

Conform to →IEC-standard

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/add.svg not defined in IEC-standard

Graphical interface

images/download/thumbnails/414782058/SIGN-version-1-modificationdate-1535032575478-api-v2.png

Available since

version 1.27.0 (for logi.CAD 3)

Functionality

The block returns information about the sign of the value that is connected to the input IN:

Value connected to IN

Return value

< 0

-1

0

0

> 0

1

Inputs, return value


Identifier

→Data type

Description

Inputs:

IN

REAL, LREAL, USINT, UINT, UDINT, ULINT, SINT, INT, DINT or LINT
(corresponds to →generic data type ANY_NUM)

value

Return value:

SINT


Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Example for usage within ST-editor

PROGRAM Test
VAR
result1, result2, result3 : SINT;
END_VAR
result1 := SIGN(INT#-5); (* The variable 'result1' evaluates to '-1'. *)
result2 := SIGN(INT#0); (* The variable 'result2' evaluates to '0'. *)
result3 := SIGN(INT#5); (* The variable 'result3' evaluates to '1'. *)
END_PROGRAM

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.