beautypg.com

3 instruction descriptions, 1 serialopen() instruction, 2 serialout() instruction – Campbell Scientific CS526 ISFET pH Probe User Manual

Page 16: 3 serialin() instruction, Instruction descriptions, Serialopen() instruction, Serialout() instruction, Serialin() instruction, Nd 7.2.3.2

background image

CS526 ISFET pH Probe

7.2.3 Instruction Descriptions

7.2.3.1 SerialOpen() Instruction

The

SerialOpen() instruction has the following syntax:

SerialOpen(ComPort,BaudRate,Format,TXDelay,BufferSize)

ComPort

— the datalogger COM port in which the probe is connected.

BaudRate

— choose 2400

Format

— choose 16, which is TTL Logic; No parity, one stop bit, 8 data

bits; No error checking

TXDelay

— enter 0

BufferSize

— enter at least twice the number of maximum expected

characters + 1, which is 41.

7.2.3.2 SerialOut() Instruction

The

SerialOut() instruction has the following syntax:

SerialOut(ComPort,OutString,WaitString,NumberTries,TimeOut)

ComPort

— the datalogger COM port in which the probe is connected.

OutString

— use "1M1!"+CHR(13) for the OutString when the default

probe address of 1 is used.

WaitString

— enter the null (“”) WaitString to tell the datalogger to wait

for the echo of each character in the OutString

NumberTries

— enter 0

TimeOut

— specifies the time, in 0.01 seconds, that the datalogger should

wait for the WaitString or echo of each character in the OutString (0

is used in the example program).

7.2.3.3 SerialIn() Instruction

The

SerialIn() instruction has the following syntax:

SerialIn(Dest,ComPort,TimeOut,TerminationChar,MaxNumChars)

Dest

— specifies the variable in which the incoming data will be stored.

Please note that in the beginning of the CRBasic program, this

variable needs to be declared as ASCII string format (see example

program in Appendix B, Example Program)

ComPort

— the datalogger COM port in which the probe is connected.

TimeOut

20 should be adequate, which gives a 200 ms maximum delay

time. The TimeOut parameter is used to specify the amount of time,

in 0.01 seconds, that the datalogger should wait before proceeding to

the next instruction.

TerminationChar

— enter

0

MaxNumChars

20 should be adequate (specify the maximum number

of characters to expect per input)

8