For other sensors or more complex applications, a CRBasic program needs to be written to
configure and enable the connection between the two devices.
To write a program, it is first necessary to determine how data will be exchanged. When using the
SDM-SIO1A to collect data from a sensor, there are two options. The data logger requests data
and then picks up the data in the response from the sensor (often called polling) or the sensor
transmits data “one-way” to the data logger at fixed intervals based upon its internal timer. The
latter mode is more common but can lead to problems with synchronizing the sensor
measurements with other measurements the data logger is making and can also lead to the
occasional missed data value if the sensor clock is running slightly slower than the data logger
clock.
The SDM-SIO1A is implemented in such a way that it looks like a built-in serial port to the user
when writing programs in CRBasic. The only difference in operation between the SDM-SIO1A and
a built-in port is that there will be a small delay as the data needs to be transferred from the
SDM-SIO1A to the data logger via the SDM port. That delay is usually only significant if large
amounts of data are being read or the data logger program needs to run very fast.
For sending and receiving data, the
SerialOpen()
instruction is used to specify which serial
port, the speed, and mode of operation. The speed is set by the
BaudRate
parameter in the
instruction and the mode (bits, parity, duplex, RS-232 or RS-485) is set by the
SerialOpenFormat
parameter. Refer to the
CRBasic Editor
help system for more details of the
options. With the correct parameters in the
SerialOpen()
instruction, the program can be
written in almost exactly the same way as using any other serial port with
SerialIn()
,
SerialOut()
, and similar instructions. The
(p. 18) section of this manual gives
details of some of the minor changes needed and some simple program examples.
The SDM-SIO1A can also be used as an interface to Modbus and DNP3 sensors or networks. The
interface is configured by including an extra
SerialOpen()
instruction at the start of the
program. Normal calls to the relevant Modbus or DNP3 instructions can then be used specifying
the COM port number relevant to the SDM-SIO1A.
6.1 Mounting
The SDM-SIO1A is normally mounted on the backplate of a Campbell Scientific enclosure using
the screws and plastic inserts provided. The SDM-SIO1A is designed to be installed in a dry, non-
condensing environment.
Before mounting, select and set the SDM address as this requires access to the side of the case.
The SDM address is set with a screwdriver.
(p. 10) lists the possible SDM addresses and
their relationships to the
COMPort
parameter in the
SerialOpen()
instruction.
SDM-SIO1A and SDM-SIO4A Serial Input/Output Modules
9