Section 7. Installation
Five variables are declared, each 36 characters long:
StringVar(1)
StringVar(2)
StringVar(3)
StringVar(4)
StringVar(5)
7.8.4.3.4 Declaring Flag Variables
A flag is a variable, usually declared
As Boolean
(p. 508),
that indicates True or
False, on or off, go or not go, etc. Program execution can be branched based on
the value in a flag. Sometime flags are simply used to inform an observer that an
event is occurring or has occurred. While any variable of any data type can be
used as a flag, using Boolean variables, especially variables named "Flag", usually
works best in practice. CRBasic example
Flag Declaration and Use
(p. 135)
demonstrates changing words in a string based on a flag.
CRBasic Example 5.
Flag Declaration and Use
'This program example demonstrates the declaration and use of flags as Boolean variables,
'and the use of strings to report flag status. To run the demonstration, send this program
'to the CR1000, then toggle variables Flag(1) and Flag(2) to true or false to see how the
'program logic sets the words "High" or "Low" in variables FlagReport(1) and FlagReport(2).
'To set a flag to true when using LoggerNet Connect Numeric Monitor, simply click on the
'forest green dot adjacent to the word "false." If using a keyboard, a choice of "True" or
'"False" is made available.
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
7.8.4.4 Declaring Arrays
Related Topics:
•
Declaring Arrays
(p. 135)
• Arrays of Multipliers and Offsets
•
VarOutOfBounds
(p. 488)
Multiple variables of the same root name can be declared. The resulting series of
like-named variables is called an array. An array is created by placing a suffix of
135
Содержание CR1000
Страница 2: ......
Страница 4: ......
Страница 6: ......
Страница 32: ......
Страница 36: ......
Страница 38: ......
Страница 40: ......
Страница 60: ...Section 4 System Quickstart Figure 16 PC200W View Line Graph 60 ...
Страница 96: ......
Страница 98: ...98 ...
Страница 302: ......
Страница 350: ...Section 8 Operation Figure 91 Pulse Sensor Output Signal Types Figure 92 Switch Closure Pulse Sensor 350 ...
Страница 453: ...Section 8 Operation Figure 115 Using the Keyboard Display 453 ...
Страница 454: ...Section 8 Operation 8 8 1 Data Display Figure 116 Displaying Data with the Keyboard Display 454 ...
Страница 456: ...Section 8 Operation Figure 118 Real Time Custom 456 ...
Страница 457: ...Section 8 Operation 8 8 1 3 Final Memory Tables Figure 119 Final Memory Tables 457 ...
Страница 458: ...Section 8 Operation 8 8 2 Run Stop Program Figure 120 Run Stop Program 458 ...
Страница 460: ...Section 8 Operation Figure 122 File Edit 460 ...
Страница 461: ...Section 8 Operation 8 8 4 PCCard Memory Card Display Figure 123 PCCard CF Card Display 461 ...
Страница 478: ......
Страница 506: ......
Страница 536: ......
Страница 636: ......
Страница 642: ......
Страница 644: ......
Страница 676: ......
Страница 677: ......