Positron Compiler Documentation

Logical or '|'

Positron16 · Revision 1.1.3.5 · PDF page 84

Assignment Variable = Variable | Variable

The Or operator returns the bitwise Or of two integer values. Each bit of the values is subject to the following logic: -

0 or 0 = 0 0 or 1 = 1 1 or 0 = 1 1 or 1 = 1

The result returned by | will contain 1s in any bit positions in which one or the other (or both) input values contain 1s.

Variables may be constants, variables or expressions. Assignment Variable can be any valid variable type.

Device = 24FJ64GA002           ' Select the device to compile for
Declare Xtal = 16      ' Tell the compiler the device will be operating at 16MHz

Declare Hserial1_Baud = 9600
Declare Hrsout1_Pin = PORTB.14

Dim MyByte1 as Byte = %00001111
Dim MyByte2 as Byte = %10101001
Dim MyResult as Byte

PPS_Output(cOut_Pin_RP14, cOut_Fn_U1TX)  ' Make Pin RB14 U1TX

MyResult = MyByte1 | MyByte2
HrsoutLn Bin MyResult    ' Display or result (%10101111)

or

HrsoutLn Bin (%00001111 | %10101001)    ' Display or result (%10101111)

Bitwise operations are not permissible with floating point values or variables.

View original PDF page 84Open page in PDFOriginal PDF page 84