SHRB - Buffer right shift

Language reference ›› Built-in functions ›› Buffer shifts ››
Parent Previous Next

SHRB(variable) NEW! (V2.0)

Shift right <variable> one bit position, introducing 0 to the MSB and returns a BOOLEAN that was the LSB value.


Restrictions:


<variable> may be any variable of type CHAR, BYTE, WORD, LONGWORD, SHORTINT, INTEGER, LONGINT, or an ARRAY of these types, or an ARRAY of BOOLEAN; in this last case, the number of elements must be multiple of 8.

<variable> cannot be a pointer or a RECORD field nor located in EEPROM.


VAR
 TheBit: BOOLEAN;
 TheBuf: ARRAY[1..5] OF BYTE;

 // Shift out the buffer to the right
 TheBit := SHRB(TheBuf);