any_to_sint / any_to_usint

PLCopen motion icon

Operator - Converts the input into a short, 8-bit integer value.

Inputs

Input

Data Type

Range

Unit

Default

Description

IN

ANY

 

 

 

Input value.

Outputs

Output

Data Type

Range

Unit

Description

Q

SINT

 

 

Value converted to a signed short integer. (8-bit).

Q

USINT

 

 

Value converted to an unsigned short integer. (8-bit).

Remarks

Can be unsigned with any_to_usint.

Data Type Outputs

  • For BOOL input data types, the output is 0 (zero) or 1.
  • For REAL input data type, the output is the integer part of the input real.
  • For TIME input data types, the output is the number of milliseconds.
  • For STRING input data types, the output is the number represented by the string or 0 (zero) if the string does not represent a valid number.

FBD Language Example

FFLD Language Example

  • In the FFLD Language, the conversion is executed only if the input rung (EN) is TRUE.
    • The output rung (ENO) keeps the same value as the input rung.

IL Language Example

  • In the IL Language, the any_to_sint converts the current result.
Op1: FFLD  IN
     ANY_TO_SINT
     ST  Q

ST Language Example

Q := ANY_TO_SINT (IN);

See Also