Positron Compiler Documentation

Bitwise Reverse '@'

Positron8 · Revision 4.0.6.5 · PDF page 93

Assignment Variable = Variable @ Variable

Reverses the order of the lowest bits in a value. The number of bits to be reversed is from 1 to 32.

Variable can be a constant, variable or expression. Assignment Variable can be any valid variable type.

16-bit Example

Device = 18F26K40             ' Select the device to compile for
Declare Xtal = 16  ' Tell the compiler the device will be operating at 16MHz
Declare Hserial_Baud = 9600   ' Set the Baud rate for HRsoutLn

Dim MyWord as Word             ' Holds the result of the reverse

MyWord = 0b10101100 @ 4       ' Sets MyWord to 10100011
HRsoutLn Bin8 MyWord           ' Send the result to a serial terminal

32-bit Example

  Device = 18F26K40             ' Select the device to compile for
  Declare Xtal = 16  ' Tell the compiler the device will be operating at 16MHz
  Declare Hserial_Baud = 9600   ' Set the Baud rate for HRsoutLn

  Dim MyDword as Dword          ' Holds the result of the reverse
'
' Sets MyDword to 10101010000000001111111110100011
'
  MyDword = 0b10101010000000001111111110101100 @ 4
  HRsoutLn Bin32 MyDword         ' Send the result to a serial terminal
View original PDF page 93Open page in PDFOriginal PDF page 93