2 control port example programs, 1 cr1000 control port example, 2 cr200(x) series control port example – Campbell Scientific TB4 and TB4MM Hydrological Services Rain Gage User Manual
Page 12

TB4 and TB4MM Rain Gage
Output Instruction 72, Totalize, is used in the output section of the program to
output the total rainfall over the output interval. This section should be
executed every scan and not placed in a subroutine or conditional statement.
5.2 Control Port Example Programs
The following examples measure a TB4 rain gage using a control port on the
datalogger. Wire the sensor as shown in Table 4-2.
5.2.1 CR1000 Control Port Example
Although this example is for the CR1000 datalogger, our CR800, CR850,
CR3000, and CR5000 are programmed similarly.
'CR1000
'CR1000 Program for TB4
'Declare Public Variables and Units
Public Rain_mm
Units Rain_mm=mm
DataTable (Rain,True,-1)
DataInterval
(0,60,Min,0)
Totalize
(1,Rain_mm,FP2,0)
EndTable
'Main Program
BeginProg
Scan
(1,Sec,1,0)
PulseCount
(Rain_mm,1,18,2,0,.254,0) ; Black wire connected to C8
CallTable
(Rain)
NextScan
EndProg
5.2.2 CR200(X) Series Control Port Example
'CR200
' A 20 kOhm pull up resistor is require to read a switch closure on C1 or C2
' as a Pulse Counter. The 20 kOhm resistor uses the battery voltage.
'Declare Public Variables and Units
Public Rain_mm
Units Rain_mm=mm
'Define Data Tables
DataTable (Rain,True,-1)
DataInterval
(0,60,min)
Totalize
(1,Rain_mm,0)
EndTable
8