9 l_tbgetbitofbyte, L_tbgetbitofbyte, Function library lenzeplctoolbox.lib – Lenze DDS Function library PLCToolBox User Manual

Page 17: Functions/function blocks

Advertising
background image

Function library LenzePLCToolBox.lib

Functions/function blocks

2.9

L_TBGetBitOfByte

2−9

L

LenzePLCToolBox.lib EN 1.5

2.9

L_TBGetBitOfByte

BOOL L_TBGetBitOfByte (byInput, byBitNr)

This function returns the state of a single bit within a "byte" value.

L_TBGetBitOfByte

0

7

byInput

byBitNr

0...7

state?

FALSE/TRUE

Transfer parameters

Identifiers

Data type

Info/possible settings

byInput

Byte

Value

byBitNr

Byte

No. (0 ... 7) of the bit of byInput whose state is to be determined.

Return value: Bool

Value

Meaning

FALSE/TRUE

State of bit byBitNr of byInput.

Example

Calling the function in ST:

byValue := 105 (* byValue = 105 dec = 01101001 bin *)

bBit0 := L_TBGetBitOfByte(byValue, 0); (* bBit0 = TRUE *)
bBit1 := L_TBGetBitOfByte(byValue, 1); (* bBit1 = FALSE *)
bBit2 := L_TBGetBitOfByte(byValue, 2); (* bBit2 = FALSE *)

Advertising