EasyManua.ls Logo

Crestron SIMPL+ - SIMPL+ Bit & Byte Functions; Bit & Byte Functions Overview; Bit Function

Crestron SIMPL+
374 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Software Crestron SIMPL+
®
100 z SIMPL+
®
Language Reference Guide - DOC. 5797G
Bit & Byte Functions
Bit & Byte Functions Overview
These functions perform bit and byte masking operations in a given SIMPL+
program.
Bit
Name:
Bit
Syntax:
INTEGER Bit(STRING SOURCE, INTEGER SOURCE_BYTE, INTEGER
BIT_IN_BYTE);
Description:
Determine the state of a specified bit in a particular byte of a given string.
Parameters:
SOURCE contains a STRING in which a bit of one byte is to be examined. Each
character in SOURCE is considered one byte.
SOURCE_BYTE references a character in the SOURCE string. The leftmost
character in SOURCE is considered 1.
BIT_IN_BYTE specifies which bit in the SOURCE_BYTE of SOURCE is to be
examined. BIT_IN_BYTE starts at position 0 (least significant or rightmost bit of the
byte). 7 is the most significant or leftmost bit of the byte.
Return Value:
Returns 0 or 1 for a valid bit position. Illegal bit references will return 65535. It is
illegal if SOURCE_BYTE is 0 or greater than the length of the SOURCE string. Note
that it is legal to specify a bit beyond 7. This will reference a bit in another byte. In
this way, a source string can be used as a set of packed bit flags. The algorithm for
determining which bit in which byte is set when BIT_IN_BYTE is greater than 7 is
as follows:
Actual Byte in SOURCE = (BIT_IN_BYTE / 8) + SOURCE_BYTE
Actual Bit in Actual Byte = (BIT_IN_BYTE MOD 8)
Applying this to BIT (“abc”,1,16) will reference bit 0 of byte 3 (the least significant
bit of byte “c” in SOURCE).

Table of Contents

Other manuals for Crestron SIMPL+

Related product manuals