BYTE

Bit string of 8 bits.

Size

8 bits

Range

16#00 to 16#FF

Default

16#00

IEC 61131-3

Section 2.3.1

Support

Supported

Literals

BYTE#16#FF
BYTE#2#11001010
BYTE#8#377

Example

flags := BYTE#16#A5;
mask := BYTE#16#0F;
result := flags AND mask;  (* result = 16#05 *)

Bit Access

Individual bits can be read and written using .n or .%Xn syntax (for example, flags.3 or flags.%X3). Valid indices are 0..7. See Bit Access.

See Also

  • WORD — 16-bit bit string

  • USINT — 8-bit unsigned integer

  • Bit Access — selecting an individual bit of a bit-string value