Section 7. Installation
166
Logical Expression Examples
The
NOT
operator complements every bit in the word. A Boolean can be FALSE (0 or all bits set to 0) or TRUE (-
1 or all bits set to 1).
Complementing
a Boolean turns TRUE to FALSE (all bits complemented to 0).
Example Program
'(a AND b) = (26 AND 26) = (&b11010 AND &b11010) =
'&b11010. NOT (&b11010) yields &b00101.
'This is non-zero, so when converted to a
'BOOLEAN, it becomes TRUE.
Public
a
As LONG
Public
b
As LONG
Public
is_true
As Boolean
Public
not_is_true
As Boolean
Public
not_a_and_b
As Boolean
BeginProg
a = 26
b = a
Scan
(1,Sec,0,0)
is_true = a
AND
b
'This evaluates to TRUE.
not_is_true = NOT (is_true)
'This evaluates to FALSE.
not_a_and_b = NOT (a AND b)
'This evaluates to TRUE!
NextScan
EndProg
7.6.3.16.5 String Expressions
CRBasic facilitates concatenation of string variables to variables of all data types
using
&
and
+
operators. To ensure consistent results, use
&
when concatenating
strings. Use
+
when concatenating strings to other variable types. CRBasic
example
String and Variable Concatenation
(p. 166)
demonstrates CRBasic code for
concatenating strings and integers. See section
String Operations
(p. 303)
in the
Programming Resource Library
(p. 171)
for more information on string
programming.
String and Variable Concatenation
'This program example demonstrates the concatenation of variables declared As String to
'other strings and to variables declared as other data types.
'
'Declare Variables
Dim
PhraseNum(2)
As Long
Dim
Word(15)
As String
* 10
Public
Phrase(2)
As String
* 80
'Declare Data Table
DataTable
(HAL,1,-1)
DataInterval
(0,15,Sec,10)
'Write phrases to data table "Test"
Sample
(2,Phrase,String)
EndTable
Summary of Contents for CR800 Series
Page 2: ......
Page 4: ......
Page 6: ......
Page 32: ......
Page 34: ......
Page 54: ......
Page 92: ......
Page 310: ......
Page 446: ...Section 8 Operation 446 8 11 2 Data Display FIGURE 100 CR1000KD Displaying Data ...
Page 448: ...Section 8 Operation 448 FIGURE 102 CR1000KD Real Time Custom ...
Page 449: ...Section 8 Operation 449 8 11 2 3 Final Storage Data FIGURE 103 CR1000KD Final Storage Data ...
Page 450: ...Section 8 Operation 450 8 11 3 Run Stop Program FIGURE 104 CR1000KD Run Stop Program ...
Page 452: ...Section 8 Operation 452 FIGURE 106 CR1000KD File Edit ...
Page 456: ......
Page 462: ......
Page 523: ...Section 11 Glossary 523 FIGURE 116 Relationships of Accuracy Precision and Resolution ...
Page 524: ......
Page 526: ......
Page 556: ......
Page 558: ......
Page 560: ......
Page 597: ......