04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Section 7. Installation<br />

7.8.8.5.1 Input Instruction Set Basics<br />

• BaudRrate — Baud rate mismatch is frequently a problem when developing<br />

a new application. Check for matching baud rates. Some developers prefer to<br />

use a fixed baud rate during initial development. When set to -nnnn (where<br />

nnnn is the baud rate) or 0, auto baud-rate detect is enabled. Autobaud is<br />

useful when using the CS I/O and RS-232 ports since it allows ports to be<br />

simultaneously used for sensor and PC telecommunications.<br />

• Format — Determines data type and if PakBus ® communications can occur<br />

on the COM port. If the port is expected to read sensor data and support<br />

normal PakBus ® telemetry operations, use an auto-baud rate argument (0 or -<br />

nnnn) and ensure this option supports PakBus ® in the specific application.<br />

• BufferSize — The buffer holds received data until it is removed. SerialIn(),<br />

SerialInRecord(), and SerialInBlock() instructions are used to read data<br />

from the buffer to variables. Once data are in variables, string manipulation<br />

instructions are used to format and parse the data.<br />

SerialClose() must be used before SerialOpen() can be used again to reconfigure<br />

the same serial port, or before the port can be used to communicate with a PC.<br />

SerialOpen() 1<br />

• Be aware of buffer size (ring memory)<br />

• Closes PPP (if active)<br />

• Returns TRUE or FALSE when set equal to a Boolean variable<br />

SerialClose()<br />

• Examples of when to close<br />

o Reopen PPP<br />

o Finished setting new settings in a Hayes modem<br />

o Finished dialing a modem<br />

• Returns TRUE or FALSE when set equal to a Boolean variable<br />

SerialFlush()<br />

• Puts the read and write pointers back to the beginning<br />

• Returns TRUE or FALSE when set equal to a Boolean variable<br />

SerialIn() 1<br />

• Can wait on the string until it comes in<br />

• Timeout is renewed after each character is received<br />

• SerialInRecord() tends to obsolete SerialIn().<br />

• Buffer-size margin (one extra record + one byte)<br />

SerialInBlock() 1<br />

• For binary data (perhaps integers, floats, data with NULL characters).<br />

• Destination can be of any type.<br />

205

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!