Crbasic example 10. flag declaration and use – Campbell Scientific CR3000 Micrologger User Manual
Page 126

Section 7. Installation
126
DataTable
(TableName,True,-1)
'FP2 Data Storage Example
Sample
(1,Z,FP2)
'IEEE4 / Float Data Storage Example
Sample
(1,X,IEEE4)
'UINT2 Data Storage Example
Sample
(1,PosCounter,UINT2)
'LONG Data Storage Example
Sample
(1,PosNegCounter,Long)
'STRING Data Storage Example
Sample
(1,FirstName,String)
'BOOLEAN Data Storage Example
Sample
(8,Switches(),Boolean)
'BOOL8 Data Storage Example
Sample
(2,FLAGS(),Bool8)
'NSEC Data Storage Example
Sample
(1,CR3000Time,Nsec)
EndTable
Flags
Flags are a useful program-control tool. While any variable of any data type can
be used as a flag, using Boolean variables, especially variables named "Flag",
works best. CRBasic example Flag Declaration and Use
(p. 126)
shows an example
using flags to change the word in string variables.
CRBasic Example 10. Flag Declaration and Use
Public
Flag(2)
As Boolean
Public
FlagReport(2)
As String
BeginProg
Scan
(1,Sec,0,0)
If
Flag(1) = True
Then
FlagReport(1) = "High"
Else
FlagReport(1) = "Low"
EndIf
If
Flag(2) = True
Then
FlagReport(2) = "High"
Else
FlagReport(2) = "Low"
EndIf
NextScan
EndProg