Skip to main content

REAL_TO_BYTE

The REAL_TO_BYTE block converts a REAL value to BYTE.

Ladder representation​

REAL_TO_BYTE Ladder representation

Block structure​

Variable TypeNameData TypeDescription
VAR_INPUTENBOOLBlock enable.
VAR_INPUTValueREALREAL value.
VAR_OUTPUTENOBOOLEnd of operation.
VAR_OUTPUTResultBYTE / USINT / SINTBYTE value.

Operation​

When EN is TRUE, the block interprets Value as a REAL value, converts it to BYTE, and stores the result in Result.

When EN is FALSE, Result remains unchanged.

The ENO output passes the EN state to the next Ladder block after the operation is finished.

Conversion Behavior

Only the eight least significant bits are considered in the result.

Conversion Behavior

Decimal results are truncated before the final value is stored.

Execution flowchart​

REAL_TO_BYTE execution flowchart

Examples​

The Ladder examples convert VALUE from REAL to BYTE, store the final value in RESULT, and activate ENO when the block finishes successfully.

REAL_TO_BYTE Ladder example

REAL_TO_BYTE Ladder example result

REAL_TO_BYTE additional Ladder example

REAL_TO_BYTE additional Ladder example