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 />

Scan(1,Sec,0,0)<br />

ProgSig = Status.ProgSignature<br />

RunSig = Status.RunSignature<br />

x = 24<br />

ExeSig(1) = Signature<br />

y = 43<br />

ExeSig(2) = Signature<br />

CallTable Signatures<br />

NextScan<br />

'function<br />

'Set variable to Status table entry<br />

'"ProgSignature"<br />

'Set variable to Status table entry<br />

'"RunSignature"<br />

'signature includes code since initial<br />

'Signature instruction<br />

'Signature includes all code since<br />

'ExeSig(1) = Signature<br />

7.8.17 Advanced Programming Examples<br />

7.8.17.1 Miscellaneous Features<br />

CRBasic example Miscellaneous Features (p. 243) demonstrates use of several<br />

CRBasic features: data type, units, names, event counters, flags, data intervals,<br />

and control.<br />

CRBasic Example 52.<br />

Miscellaneous Features<br />

'This program demonstrates the use of documentation data types, units, names, event<br />

'counters, flags, data intervals, and simple control algorithms.<br />

'A program can be (and should be!) extensively documented. Any text preceded by an<br />

'apostrophe is ignored by the CRBasic compiler.<br />

'One thermocouple is measured twice using the wiring panel temperature as the reference<br />

'temperature. The first measurement is reported in Degrees C, the second in Degrees F.<br />

'The first measurement is then converted from Degree C to Degrees F on the subsequent<br />

'line, the result being placed in another variable. The difference between the panel<br />

'reference temperature and the first measurement is calculated, the difference is then<br />

'used to control the status of a program control flag. Program control then<br />

'transitions into device control as the status of the flag is used to determine the<br />

'state of a control port that controls an LED (light emitting diode).<br />

'Battery voltage is measured and stored just because good programming practice dictates<br />

'it be so.<br />

'Two data storage tables are created. Table “OneMin” is an interval driven table that<br />

'stores data every minute as determined by the <strong>CR1000</strong> clock. Table “Event” is an event<br />

'driven table that only stores data when certain conditions are met.<br />

243

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

Saved successfully!

Ooh no, something went wrong!