beautypg.com

C.1 example calibration program – Campbell Scientific CS526 ISFET pH Probe User Manual

Page 26

background image

Appendix C. Calibration

C.1 Example Calibration Program

Following is a simple example program to facilitate the two-point calibration.

Although this is a CR1000 program, the other dataloggers are programmed

similarly.

'CR1000 Series Datalogger
'Define Variables
Public pH, pHCount
Public PTemp, batt_volt
Public pH4record, pH4Count
Public pH7record, pH7Count
Public pHcal, pHmult1
Public pHoffset1

Dim rawstring As String * 20, pHDigit(2)

'Define Data Tables
DataTable (TenMin,1,-1)
DataInterval (0,10,Min,10)
Average (1,pH,FP2,False)
EndTable

'Main Program
BeginProg
SerialOpen (Com1,2400,16,0,41)

Scan (10,Sec,0,0)
PanelTemp (PTemp,250)
Battery (batt_volt)
SerialOut (Com1,"1M1!"&CHR(13),"",0,0)
SerialIn (rawstring,Com1,20,0,20)
SplitStr (pHDigit(),rawstring,"String",2,0)
pHCount = pHDigit(2)

'Calibration
If PH4record = -1 Then
pH4Count = pHCount
pH4record = 0
EndIf

If pH7record = -1 Then
pH7Count = pHCount
pH7record = 0
EndIf

If pHcal = -1 Then
pHmult1 = 3/(pH7Count - pH4Count)
pHoffset1 = 7 - pHmult1 * pH7Count
pHcal = 0
EndIf

pH = pHmult1 * pHCount + pHoffset1

CallTable TenMin
NextScan
EndProg

C-2