17 l_tbsetbitofword, Function library lenzeplctoolbox.lib, Functions/function blocks – Lenze DDS Function library PLCToolBox User Manual

Page 25

Advertising
background image

Function library LenzePLCToolBox.lib

Functions/function blocks

2.17

L_TBSetBitOfWord

2−17

L

LenzePLCToolBox.lib EN 1.5

2.17

L_TBSetBitOfWord

WORD L_TBSetBitOfWord (wInput, byBitNr)

This function sets a single bit in a value of type "word" to "1".

L_TBSetBitOfWord

0

15

wInput

byBitNr

1

0...15

Set

Transfer parameters

Identifiers

Data type

Info/possible settings

wInput

Word

Value in which a bit is to be set to 1".

byBitNr

Byte

No. (0 ... 15) of the bit to be set.

Return value: Word

Value

Meaning

0 ... 65535

Value of type "word" resulting from the set bit.

Example

Calling the function in ST:

wValue := 97 (* wValue = 97 dec = 01100001 bin *)

wValue := L_TBSetBitOfWord(wValue, 3); (* set bit 3 *)

(* wValue = 105 dec = 01101001 bin *)

Advertising