BitAt

 

Description

Returns the Bit at given location in an user buffer or in the PDU.DATA buffer.

Declaration

bool BitAt(void *Buffer, int ByteIndex, byte BitIndex);

bool BitAt(int ByteIndex, byte BitIndex);

 

 

Parameters

 

Type

Dir.

 

Buffer

Pointer

In

Pointer to an user buffer

ByteIndex

int

In

Start byte

BitIndex

byte

In

Bit inside the byte

 

Example

IsOn=S7.BitAt(&MyBuffer, 140, 2);

“IsOn” is true if the third bit of the byte 140 of MyBuffer is 1.

IsOn=S7.BitAt(140, 2);

“IsOn” is true if (PDU.DATA[140] & 0x04)!=0