Default program

Many data logger settings can be changed remotely over a communications link. This convenience comes with the risk of inadvertently changing settings and disabling communications. For example, external cellular modems are often controlled by a switched 12 VDC (SW12 (SW1, SW2)) terminal. SW12 (SW1, SW2) is normally off; so, if the program controlling SW12 (SW1, SW2) is disabled, such as by changing a setting or sending a new operating system, the cellular modem is switched off and the remote data logger will not turn it on. This could require an on-site visit to correct the problem unless a special program called default has been installed.

Having a default.CRB program stored on the data logger will also ensure that a non-compiling CRBasic program does not lock out a remote user.

NOTE:

The default program may use the extension .CRB or .DLD.

When a file named default.CRB is stored on the data logger CPU: drive, it is loaded if no other program takes priority. Program execution priorities are as follows: 

  1. When the CR350 powers up, a program file marked as Run On Power-up will run. If that program includes a file specified by the Include File setting, it will be incorporated into the program that runs.
  2. If there is no program file marked Run Now or Run On Power-up (or if the program selected to run cannot be compiled), the data logger will run the program specified by the IncludeFile setting. For more information see IncludeFile.
  3. If the IncludeFile program cannot be compiled or if no program is specified, the data logger will attempt to run the program named default.CRB on its CPU: drive.
  4. If there is no default.CRB file or it cannot be compiled, the CR350 will not automatically run any program.

The default.CRB program generally contains instructions to preserve critical datalogger settings such as communications settings, but should not be more than a few lines of code.

default.CRB example

'This program turns ON the SW12 (SW1, SW2) switched

'power terminal, for 30 seconds every 60 seconds.

BeginProg

Scan(1,Sec,0,0)

If TimeIsBetween (15,45,60,Sec) Then SW12(SW12_1,1)

NextScan

EndProg

Downloading operating systems over communications requires much of the available CR350 memory. If the intent is to load operating systems via a communications link and have a default.CRB file in the CR350, the default.CRB program should not allocate significant memory, as might happen by allocating a large USR: drive. Also, do not auto-allocate tables in DataTable() instructions; if it is necessary to use DataTable() instructions, set small fixed table sizes. Refer to Sending an operating system to a remote data logger for information about sending the operating system.