Campbell CS526 Instruction Manual - page 13
CS526 ISFET pH Probe
8.2.2.4 SplitStr() Instruction
The SplitStr() instruction has the following syntax:
SplitStr(SplitResult,SearchString,FilterString,NumSplit,SplitOption)
SplitResult — an array in which the split string will be stored.
SearchString — the string on which this instruction will operate. This will
be the variable entered for the Dest parameter for the SerialIn()
instruction (see above).
FilterString — enter “String” (this value will be ignored because of the
SplitOption that will be used).
NumSplit — enter 2
SplitOption — enter 0. This splits out numeric values.
8.2.3 Example Program
The following is a CR1000 program that measures the CS526. This program
assumes the CS526 is connected to COM1 (C1 / TX and C2 / RX) on the
CR1000.
'CR1000 Series Datalogger
'Declare variable for digital pH measurement
Public pHCount
'Declare variables for serial input from sensor
Dim rawstring As String * 20, pHDigit(2)
'Main Program
BeginProg
'Set up datalogger port for serial communication
SerialOpen ( Com1,2400,16,0,41)
'Establish program scan rate of 60 seconds
Scan
(60,Sec,0,0)
'Send get data command to CS526
SerialOut
(Com1,"1M1!"&CHR(13),"",0,0)
'Set up COM1 to receive incoming serial data.
'Set timeout to maximum 200 mS
SerialIn
(rawstring,Com1,20,0,20)
'Split out digital count value for pH from string input
SplitStr
(pHDigit(),rawstring,"String",2,0)
pHCount
=
pHDigit(2)
NextScan
EndProg
8.2.4 Programming for Calibration
To output in pH units instead of digital counts, enter the offset and multiplier
into the datalogger program. Simple program instructions can be used to make
the required periodic calibration easier. See Appendix A, Calibration, for an
example program.
7