beautypg.com

Filemanage, Filemanage example – Campbell Scientific CR9000X Measurement and Control System User Manual

Page 335

background image

Section 9. Program Control Instructions

The next example show the use of Wend.
While X > Y

'Old fashioned way of looping.

.........
Wend

The following is equivalent to the prior While/Wend construct with easier to
follow context:
Do While X > Y

'Much better

.........
.........
Loop

FileManage

The FileManage instruction is used to manage files from within a running
datalogger program.

Syntax
FileManage( "Device: FileName", Attribute )

Remarks
FileManage
is a function that allows the active datalogger program to
manipulate program files that are stored in the datalogger.

Parameter
& Data Type

Enter

FILEMANAGE PARAMETERS

Device;
Filename
Text

The "Device:Filename" argument is the file that should be manipulated.
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
Constant

The Attribute is a numeric code to set what will happen to the file affected
by the FileManage instruction. The Attribute codes are actually a bit field.
The codes are as follows: Setting a file's attributes to Hide makes it
inaccessible using communications or the keyboard, but it can still be set as
Run Now or Run on Power Up..

Bit

Decimal

Description

bit 0

1

Program not active

bit 1

2

Run on power up

bit 2

4

Run now

bits 1 & 2

6

Run now and on power up

bit 3

8

Delete

bit 4

16

Delete all

bit 5

32

Hide

FileManage Example
The statement below uses FileManage to run TEMPS.C9X, which is stored on
the datalogger's CPU, when Flag(2) becomes high. The currently running
program will be stopped and TEMPS.C9X will start running.

If Flag(2) then

FileManage

( "CPU:TEMPS.C9X" 4 ) '4 means Run Now

9-5