beautypg.com

17 advanced programming examples, 1 miscellaneous features, Table 39. string concatenation examples – Campbell Scientific CR800 and CR850 Measurement and Control Systems User Manual

Page 244: Table 40. string null character examples

background image

Section 7. Installation

244 

 

 

'function

Scan

(1,Sec,0,0)

ProgSig = Status.ProgSignature

'Set variable to Status table entry

'"ProgSignature"

RunSig = Status.RunSignature

'Set variable to Status table entry

'"RunSignature"

x = 24
ExeSig(1) = Signature

'signature includes code since initial

'Signature instruction

y = 43
ExeSig(2) = Signature

'Signature includes all code since

'ExeSig(1) = Signature

CallTable

Signatures

NextScan

 

7.8.17 Advanced Programming Examples

7.8.17.1 Miscellaneous Features

CRBasic example Miscellaneous Features

(p. 244)

demonstrates use of several

CRBasic features: data type, units, names, event counters, flags, data intervals,
and control.

CRBasic Example 52. Miscellaneous Features 

'This program demonstrates the use of documentation data types, units, names, event

'counters, flags, data intervals, and simple control algorithms.

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

'apostrophe is ignored by the CRBasic compiler.

'One thermocouple is measured twice using the wiring panel temperature as the reference

'temperature. The first measurement is reported in Degrees C, the second in Degrees F.

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

'line, the result being placed in another variable. The difference between the panel

'reference temperature and the first measurement is calculated, the difference is then

'used to control the status of a program control flag. Program control then

'transitions into device control as the status of the flag is used to determine the

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

'Battery voltage is measured and stored just because good programming practice dictates

'it be so.

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

'stores data every minute as determined by the CR1000 clock. Table “Event” is an event

'driven table that only stores data when certain conditions are met.