
Section 9. Program Control Instructions
If...Then ... Else Statement Example
The example illustrates the various forms of the If...Then...Else syntax.
Dim X, Y, Temp( 5 ) 'Declare variables.
X = Temp( 1 )
If X < 10 Then
Y = 1 '1 digit.
ElseIf X < 100 Then
Y = 2 '2 digits.
Else
Y = 3 '3 digits.
EndIf
. . . . 'Run some code
. . . . 'Run some code
RunProgram
The RunProgram instruction is used to run a datalogger program file from the
active program file.
Syntax
RunProgram ( "Device:FileName", Attrib )
Remarks
The RunProgram has the following parameters:
"Device:FileName" The "Device:Filename" argument is the file that should
be executed. The Device on which the file is stored
must be specified and the entire string must be enclosed
in quotation marks. Device = CPU, the file is stored in
datalogger memory. Device = CRD, the file is stored
on a PCMCIA card.
Attribute The Attribute is a numeric code to determine what
should happen to the file called by the RunDLDFile
instruction. The Attribute codes are actually a bit field.
The codes are as follows:
Bit Decimal Description
bit 1 2 Run on power up
bit 2 4 Run now
RunProgram Example
The statement below uses RunProgram to run TEMPS.DLD, which is stored
on the datalogger's CPU, when Flag(2) becomes high.
If Flag(2) then RunProgram ( "CPU:TEMPS.DLD" 4 ) '4 means Run Now
9-11
Komentáře k této Příručce