Table 43. formatting strings examples, Crbasic example 49. form – Campbell Scientific CR800 and CR850 Measurement and Control Systems User Manual

Page 246

Advertising
background image

Section 7. Installation

246 

 

 

Minimum

(1,AirTemp_C,FP2,0,False)

'Stores temperature minimum in low

'resolution format

Sample

(1,DeltaT_C, FP2)

'Stores temp difference sample in low

'resolution format

Sample

(1,HowMany, FP2)

'Stores how many data events in low

'resolution format

EndTable

BeginProg

'A second way of naming a station is to load the name into a string variable. The is

'place here so it is executed only once, which saves a small amount of program

'execution time.


SiteName = "CR1000SiteName"

Scan

(1,Sec,1,0)

'Measurements

'Battery Voltage

Battery

(Batt_Volt)

'Wiring Panel Temperature

PanelTemp

(PTemp_C,_60Hz)

'Type T Thermocouple measurements:

TCDiff

(AirTemp_C,1,mV2_5C,1,TypeT,PTemp_C,True,0,_60Hz,1,0)

TCDiff

(AirTemp_F,1,mV2_5C,1,TypeT,PTemp_C,True,0,_60Hz,1.8,32)

'Convert from degree C to degree F

AirTemp2_F = AirTemp_C * 1.8 + 32

'Count the number of times through the program. This demonstrates the use of a

'Long integer variable in counters.

Counter = Counter + 1

'Calculate the difference between air and panel temps

DeltaT_C = AirTemp_C - PTemp_C

'Control the flag based on the difference in temperature. If DeltaT >= 3 then

'set Flag 1 high, otherwise set it low

If

DeltaT_C >= 3

Then

Flag(1) = high

Else

Flag(1) = low

EndIf

'Turn LED connected to Port 1 on when Flag 1 is high

If

Flag(1) = high

Then

PortSet

(1,1)

'alternate syntax: PortSet(1,high)

Else

PortSet

(1,0)

'alternate syntax: PortSet(1,low)

EndIf

Advertising