Campbell-scientific CR3000 Micrologger Manuel d'utilisateur Page 152

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 590
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 151
Section 7. Installation
152
Table 22. Logical Expression Examples
If X >= 5 AND Z = 2 then Y = 0
Sets Y = 0 only if both X >= 5 and Z = 2 are true.
If 6 then Y = 0.
If 6 is true since 6 (a non-zero number) is returned, so Y is set to 0 every time the statement is executed.
If 0 then Y = 0.
If 0 is false since 0 is returned, so Y will never be set to 0 by this statement.
Z = (X > Y).
Z equals -1 if X > Y, or Z will equal 0 if X <= Y.
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.7.3.9.5 String Expressions
CRBasic allows the addition or concatenation of string variables to variables of all
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. 152) demonstrates
CRBasic code for concatenating strings and integers.
CRBasicExample23. StringandVariableConcatenation
'Declare Variables
Dim Wrd(8) As String * 10
Public Phrase(2) As String * 80
Public PhraseNum(2) As Long
'Declare Data Table
DataTable(Test,1,-1)
DataInterval(0,15,Sec,10)
'Write phrases to data table "Test"
Sample(2,Phrase,String)
EndTable
Vue de la page 151
1 2 ... 147 148 149 150 151 152 153 154 155 156 157 ... 589 590

Commentaires sur ces manuels

Pas de commentaire