A.6.5 logical operators – Campbell Scientific CR800 and CR850 Measurement and Control Systems User Manual
Page 473

Appendix A. CRBasic Programming Instructions
473
CRBasic Example 69. Using Bit‐Shift Operators
Dim
input_val
As Long
Dim
value_1
As Long
Dim
value_2
As Long
Dim
value_3
As Long
'read input_val somehow
value_1 = (input_val AND &B11000000) >> 6
value_2 = (input_val AND &B00110000) >> 4
'note that value_3 does not need to be shifted
value_3 = (input_val AND &B00001111)
A.6.5 Logical Operators
AND
Performs a logical conjunction on two expressions.
Syntax
result = expr1 AND expr2
EQV
Performs a logical equivalence on two expressions.
Syntax
result = expr1 EQV expr2
NOT
Performs a logical negation on an expression.
Syntax
result = NOT expression
OR
Performs a logical disjunction on two expressions.
Syntax
result = expr1 OR expr2
XOR
Performs a logical exclusion on two expressions.
Syntax
result = expr1 XOR expr2
IIF
Evaluates a variable or expression and returns one of two results based on the
outcome of that evaluation.
Syntax
Result = IIF (Expression, TrueValue, FalseValue)
IMP
Performs a logical implication on two expressions.
Syntax
result = expression1 IMP expression2