beautypg.com

7 conditional compilation – Campbell Scientific CR1000 Measurement and Control System User Manual

Page 198

background image

Section 7. Installation

198 

 

 

'Measure Two Thermocouples

TCDiff

(TCTemp(),2,mV2500C,1,TypeT,RefTemp,True,0,250,1.0,0)

CallTable

TempC

'Call data table

'Menu Item "Make Notes" Support Code

If

CycleNotes = "Accept"

Then

CallTable

Notes

'Write data to Notes data table

CycleNotes = "Accepted"

'Write "Accepted" after written

Delay

(1,500,mSec)

'Pause so user can read "Accepted"

SelectNote = ""

'Clear pick list note

EnterNote = ""

'Clear free entry note

CycleNotes = "??????"

'Write ????? as a null prompt

EndIf

If

CycleNotes = "Clear"

Then

'Clear notes when requested

SelectNote = ""

'Clear pick list note

EnterNote = ""

'Clear free entry note

CycleNotes = "??????"

'Write ????? as a null prompt

EndIf

'Menu Item "Control" Menu Support Code

CountDown = CountDown - 1

'Count down by 1

If

CountDown <= 0

'Stop count down from passing 0

CountDown = 0

EndIf

If

CountDown > 0

Then

StartFlag = True

'Indicate countdown started

EndIf

If

StartFlag = True

AND

CountDown = 0

Then

'Interprocess count down

'and manual LED

ToggleLED = True
StartFlag = False

EndIf

If

StartFlag = True

AND

CountDown <> 0

Then

'Interprocess count down and manual LED

ToggleLED = False

EndIf

PortSet

(4,ToggleLED)

'Set control port according

'to result of processing

NextScan

EndProg

 

7.8.7 Conditional Compilation

When a CRBasic user program is sent to the CR1000, an exact copy of the
program is saved as a file on the CPU: drive

(p. 330).

A binary version of the

program, the "operating program", is created by the CR1000 compiler and written
to Operating Memory

(p. 331).

This is the program version that runs the CR1000.

CRBasic allows definition of # conditional code in the user program that the
CR1000 compiler includes, depending on the conditional settings, in the operating
program. This means the user-written program is evaluated for conditional
statements and an operating program that includes only the requested statements
is written to operating memory. In addition, all CRBasic dataloggers accept
program files or Include() instruction files with .DLD extensions. This gets
around the system filters that look at file extensions for specific loggers; it makes
possible the writing of a single file of code to run on multiple CRBasic
dataloggers.