04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Section 7. Installation<br />

Note Do not confuse CRBasic files with .DLD extensions with files of .DLD<br />

type used by legacy <strong>Campbell</strong> <strong>Scientific</strong> dataloggers.<br />

As an example, pseudo code using this feature might be written as:<br />

#Const Destination = "<strong>CR1000</strong>"<br />

#If Destination = "CR3000" Then<br />

<br />

#ElseIf Destination = "<strong>CR1000</strong>" Then<br />

<br />

#ElseIf Destination = "CR800" Then<br />

<br />

#Else<br />

<br />

#EndIf<br />

This logic allows a simple change of a constant to direct, for instance, which<br />

measurement instructions to include.<br />

CRBasic Editor now features a pre-compile option that enables the creation of a<br />

CRBasic text file with only the desired conditional statements from a larger<br />

master program. This option can also be used at the pre-compiler command line<br />

by using -p . This feature allows the smallest size program file<br />

possible to be sent to the <strong>CR1000</strong>, which may help keep costs down over very<br />

expensive telecommunications links.<br />

CRBasic example Conditional Compile (p. 199) shows a sample program that<br />

demonstrates use of conditional compilation features in CRBasic. Within the<br />

program are examples showing the use of the predefined LoggerType constant<br />

and associated predefined datalogger constants (CR800, <strong>CR1000</strong>, and CR3000).<br />

CRBasic Example 39.<br />

Conditional Compile<br />

'Conditional compilation example for CR3000, <strong>CR1000</strong>, and CR800 Series Dataloggers<br />

'Key instructions include #If, #ElseIf, #Else and #EndIf.<br />

'Set program options based on the setting of a constant in the program.<br />

Const ProgramSpeed = 2<br />

#If ProgramSpeed = 1<br />

Const ScanRate = 1<br />

Const Speed = "1 Second"<br />

#ElseIf ProgramSpeed = 2<br />

Const ScanRate = 10<br />

Const Speed = "10 Second"<br />

#ElseIf ProgramSpeed = 3<br />

Const ScanRate = 30<br />

Const Speed = "30 Second"<br />

#Else<br />

Const ScanRate = 5<br />

Const Speed = "5 Second"<br />

#EndIf<br />

'1 second<br />

'10 seconds<br />

'30 seconds<br />

'5 seconds<br />

'Choose a COM port depending on which logger type the program is running in.<br />

#If LoggerType = CR3000<br />

Const SourcSerialPort = Com3<br />

#ElseIf LoggerTypes = <strong>CR1000</strong><br />

Const SourcSerialPort = Com2<br />

199

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!