Programming; Crbasic Instructions; Serialopen() - Campbell SDM-SIO1A Instruction Manual

Serial input/output module
Hide thumbs Also See for SDM-SIO1A:
Table of Contents

Advertisement

6.3

Programming

The normal serial port instructions such as SerialOpen() and SerialIn() are
used with the SDM-SIO1A. Aside from changes to the COMPort and the
SerialOpenFormat parameter, a program written for a standard serial port will
usually work with the SDM-SIO1A. The main difference to be aware of, when
trying to write fast running programs, is the extra delay needed to transfer data
from the SDM-SIO1A to the datalogger (roughly equivalent to transferring
data over a serial link at 38 kilobaud).
The following section gives further information about the CRBasic
programming language and how the serial instructions are to be used with the
SDM-SIO1A.
This section assumes the user has knowledge of the CRBasic programming
language. A useful introduction to programming for serial sensors can be found
here:
https://s.campbellsci.com/documents/sp/technical-papers/serial.pdf
Please contact Campbell Scientific for further assistance or training. Campbell
Scientific's user forum is also a useful resource to check if others might have
already written code for a specific serial device.
Only the parameters that need special explanation or whose functionality has
changed when used with the SDM-SIO1A are listed below. Any other
parameters should be taken as not having changed. Please refer to the
datalogger manual and/or the CRBasic Editor help system for more guidance.

6.3.1 CRBasic Instructions

6.3.1.1 SerialOpen()

All internal buffers in the SDM-SIO1A will be flushed when this instruction is
called, resulting in the loss of any data that might have been in them at that
point in time.
COMPort
The COMPort numbers are defined in TABLE 6-1, SDM Address Settings
. COM port numbers in the range of 32 to 47 are reserved for use with
(p. 8)
the SDM-SIO1A.
BaudRate
BaudRate is used to set up the SDM-SIO1A baud rate as you would with
any RS-232 interface. The SDM-SIO1A does not support automatic baud
rate recognition. Instead, setting the rate to a negative number sets the
automatic flow control system (RTS/CTS). This system is discussed in
greater detail in Section 7.1.1, Using RTS/CTS and Automatic
Handshaking
.
(p. 22)
SerialOpenFormat
This parameter sets the data format. It also determines whether the
SDM-SIO1A works in normal RS-232, listen-only RS-232, full-duplex
RS-485, or half-duplex RS-485 mode as defined in the tables below.
SDM-SIO1A Serial Input/Output Module
15

Advertisement

Table of Contents
loading

Table of Contents