NumericToBits Function Block

This function block converts an integer value into maximum 24 bits. Often bits are used for configuration, since a 3-byte number (24 bits) can be used to handle up to 24 different meanings. Each bit can be set individually to 0 or 1. This function determines each individual bit from one of the 3 bytes of the integer value, whereby each bit can be "0", "1" or "null".

Figure 1: NumericToBits-Function Block

Figure 2: NumericToBits-Property Sheet

Input

Input Name

Description

In

This input represents the integer number to be divided into bits. The integer number is maximum 4 bytes long (32 bits).

Range: 0-16777215 or "null". If In is "null", all outputs are "null".

Table 1:Inputs of NumericToBits Function

Output

Output Name

Description

Bit0 - Bit7

Represents the bits, where bit0 represents the least significant bit.

The bits are either 0 or 1 or if In is set to "null", Bit0 - Bit7 is set to "null".

Byte

Represents the byte value as an integer value of the byte selected through the offset.

The Byte has the value 0 - 255 or if In is set to "null", Byte is set to "null".

Table 2:Output of NumericToBits Function

Parameter

Parameter Name

Description

Byte Offset

If the input value In consists of several bytes, you can select the byte which is to be divided into bits. 0 = lowest byte (outer right).

Valid Range is 0 - 2(0 is the default).

Table 3:Parameter of NumericToBit Function

Example:

The value 26434 is to be broken down into bits; the value corresponds to 67 42 in hexadecimal representation, that means it consists of 2 bytes. The lower byte is on the right (42 hex) and the higher byte on the left (67 hex). To split the lower byte, select Byte Offset = 0. To split the next byte, the offset = 1 must be selected. With Offset = 0, the lower byte (42 hex) represents the integer value (Output Byte) as value 66 and the binary value as value 0100 0010.

Figure 3: NumericToBits calculation example

Figure 4: NumericToBits functionblock example

Figure 5: NumericToBits Property Sheet Byte 0

Figure 6:NumericToBits Property Sheet Byte 1

Refer to General Description for general information about IRMN4 Function Blocks.