Appendix b. example programs, B.1 crbasic program, Appendix b – Campbell Scientific CSIM11 pH and ORP Sensors User Manual
Page 27

Appendix B. Example Programs
B.1 CRBasic Program
The following CR1000 program measures a CSIM11 and 107 temperature
probe and has the datalogger process the raw data after each measurement
sequence.
'CR1000 Series Datalogger 
 
'declare variables 
Public pH, pHMult, TempC 
 
'Define Data Tables 
DataTable (pH,1,-1) 
 DataInterval (0,1,Min,10) 
 Sample (1,pH,FP2) 
 Sample (1,TempC,FP2) 
EndTable 
 
'Main Program 
BeginProg 
 Scan (60,Sec,0,0) 
 
 'measure water temperature 
 Therm107 (TempC,1,3,Vx1,0,250,1.0,0) 
 
 'calculate the Multiplier for Temperature Correction 
 pHMult = -1/ (((TempC + 273) / 298) * 59) 
 
 'measure pH (note this is without the multplier and offset) 
 VoltDiff (pH,1,mV2500,1,True ,0,_60Hz,1.0,0) 
 
 pH=pH*pHMult 'now apply Correction Multiplier to measured pH 
 
 pH=pH + 7 
'... and the offset -- initially with a value of 7, adjusting as
'necessary during probe calibration
 
 CallTable pH 'output data once per minute 
 
 NextScan 
EndProg 
B-1
