Access to bits of an integer

You can directly specify a bit within an integer variable in expressions and diagrams, using the following notation:

    Variable.BitNo

Where:

Variable: is the name of an integer variable
BitNo: is the number of the bit in the integer.

The variable can have one of the following data types:

SINT, USINT, BYTE (8 bits from .0 to .7)
INT, UINT, WORD (16 bits from .0 to .15)
DINT, UDINT, DWORD (32 bits from .0 to 31)
LINT, ULINT, LWORD, (64 bits from 0 to 63)

0 always represents the less significant bit.

 


Stay Connected with Kollmorgen

Copyright © 2018 Kollmorgen