ByteToBit, Byte to bit conversion

List

This page is part of the IEC 61131-3 Programming Manual. Go to the index.

This function block allows you to convert a variable BYTE in 8 variables BOOL. The status of each bit of the input variable is transferred to the respective variable BOOL of exit.

Function lock
CODESYS: Not available
LogicLab: eLLabUtyLib

In (BYTE) Value to be converted.

b0 (BOOL) 0 bit of the BYTE di In.

b... (BOOL) Bit ... del BYTE di In.

b7 (BOOL) 7 bit of the BYTE di In.

Examples

How to use the examples.
In the example 8 variables BOOL they are transferred to a variable BYTE, in the state of each IBit corresponds the relative bit in the variable OByte.

LogicLab (Ptp114)
PROGRAM FBD_ByteToBit
VAR
    BDec : ByteToBit; (* Byte decompress *)
    IByte : BYTE; (* Input byte *)
    OBit : ARRAY[ 0..7 ] OF BOOL; (* Output bits *)
END_VAR

LogicLab (Ptp114)
LogicLab (Ptp114)
Was this article helpful?