Include

The Include instruction lets you insert a portion of a program file that is stored outside the main program. This is especially useful when deploying and maintaining a network of data loggers across multiple locations, where multiple programs can share common sections of code.

NOTE:   The newer IncludeSection() instruction improves on the Include() instruction by allowing multiple named sections to be defined within a single include file, also called a file library.

Syntax

Include  "Device:Filename"

Remarks

The Include file can be a subroutine, slow sequence, or any portion of code that you do not want to display in the main program. The code from the Include file is inserted in the program wherever the Include statement resides. If the Include file is not found on the datalogger (or in the same directory in which the file is being precompiled in CRBasic) an error message is returned. To see Include files expanded in a CRBasic program, use the Conditional Compile, Include Files and Save option from the Compile menu. This compile option is available in LoggerNet version 4.5 and later.

Parameter

"Device: FileName"

The "Device:Filename" argument is the file that contains the additional code 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. Valid devices are:

Device Description
CPU: Internal CPU
CRD: External Memory Card
USR: User-Defined Drive
USB: SC115

The USR device is an area of memory that can be set up by the user by assigning a value to the datalogger's UsrDriveSize setting in the Status table. This drive must be set to at least 8192 bytes, in 512-byte increments (if the value entered is not a multiple of 512 bytes, the size will be rounded up).

The Include filename can also be an expression, such as "CPU:" + StationNameSetting + ".cr6", where StationNameSetting inserts the station name of the datalogger.