beautypg.com

2 default.cr1 file, 4 program run priorities, Crbasic example 3. simple default.cr1 file – Campbell Scientific CR1000 Measurement and Control System User Manual

Page 106

background image

Section 7. Installation

106 

 

 

'<<<<<<<<<<<<<<<<<<<<<<

SlowSequence

Scan

(1,Sec,0,0)

If TimeIntoInterval

(9,24,Hr)

Then SW12

(1)

'Modem on at 9:00 AM

If TimeIntoInterval

(17,24,Hr)

Then SW12

(0)

'Modem off at 5:00 PM

NextScan

'<<<<<<<<<<<<<<<<<<<<<<<<<<

 

7.6.3.3.2 Default.cr1 File

Default.cr1 can be stored on the CR1000 CPU: drive. At power up, the CR1000
loads default.cr1 if no other program takes priority (see Program Run Priorities

(p.

106)

). Default.cr1 can be edited to preserve critical datalogger settings such as

communication settings, but cannot be more than a few lines of code.

Downloading operating systems over telecommunications requires much of the
available CR1000 memory. If the intent is to load operating systems via
telecommunications and have a default.cr1 file in the CR1000, the default.cr1
program should not use significant memory, such as occurs by allocating a large
USR: drive, or by using a DataTable() instruction with auto allocation of
memory.

CRBasic Example 3.

Simple Default.cr1 File 

'This default.cr1 file controls the SW-12 switched power terminal

BeginProg

Scan

(1,Sec,0,0)

If

TimeIntoInterval(15,60,Sec)

Then

SW12(1)

If

TimeIntoInterval(45,60,Sec)

Then

SW12(0)

NextScan

EndProg

 

7.6.3.4 Program Run Priorities

1. When the CR1000 starts, it executes commands in the powerup.ini file (on CF

card (CRD: drive) or Campbell Scientific mass-storage media (USB: drive)),
including commands to set program file (i.e., .cr1 files) attributes to Run Now
or Run On Power Up.

2. When the CR1000 powers up, a program file marked as Run On Power-up

will be the current program. Otherwise, any file marked as Run Now will be
used.

3. If there is a file specified in the Include File Name setting, it is compiled at

the end of the program selected in 1).

4. If there is no file selected in 1), or if the selected file cannot be compiled, the

CR1000 will attempt to run the program listed in the Include File Name
setting. The CR1000 allows a SlowSequence statement to take the place of
the BeginProg statement. This allows the "Include" file to act both as an
"Include" file and as the default program.

5. If the program listed in the Include File Name setting cannot be run or if no

program is specified, the CR1000 will attempt to run the program named
default.cr1 on its CPU: drive.