beautypg.com

Syntax, Array, Constant – Campbell Scientific CR9000X Measurement and Control System User Manual

Page 358

background image

Section 9. Program Control Instructions

CalFile(Source/Dest, NumVals, "Device:filename", Option)

The CalFile instruction provides a way to store sensor calibration data from a
program into a file located on the CRD: drive or the CPU: drive as well as to
the CR9000X's non-volatile Flash memory with the same instruction. When
the CR9000X is powered up, all Calibration Files located in flash memory will
be loaded into SDRAM memory.

Syntax

CalFile (Source/Dest, NumVals, "Device:filename", Option

)

Remarks
The data in the file is stored as 4 byte binary single precision floating point
values (in the native format of the logger) with a 2 byte signature appended to
the end of the data. This signature is checked (if reading) to verify that the file
is not corrupt.

The CalFile instruction has these parts:

Parameter
& Data Type

Enter

CALFILE PARAMETERS

Source/Dest
Array

A variable array specifying where to read data from or write data to.

NumVals
Constant

The number of values that should be written to or read from the calibration
file.

Device;
Filename
Text

The Device on which the file is stored and the FileName 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..

Option

Numeric code to determine whether to create or read a calibration file.

Constant

0

Write source array to File

1

Read data from file and if signature matches, write to array

2

Write source array to file and commit file to flash memory.

3

Commit file system contents to non-volatile memory.

CalFile Instruction Example
Const
numvals = 25

:

dim i

Public tfail, tdone, array1(numvals), array2(numvals)

BeginProg

for i = 1 to numvals

array1(i) = i

'write values into array

next i

CALFILE

(array1,numvals,”CPU:calfile.cal”,0)

'store the values to the file

CALFILE

(array2,numvals,”CPU:calfile.cal”,1)

'read the values to array2

for i = 1 to numvals

'test retrieved values

if array2(i) <> array1(i) then

tfail = 1

endif

next i

tdone = 1

EndProg

9-28