Positron Compiler Documentation

Bitwise Reverse '@'

Source: Positron8 Compiler User Manual, PDF page 93

Syntax

Assignment Variable = Variable @ Variable

Overview

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

Operands

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