l
hexVar0 = &H01: V+ unchanged, 12V ON
l
hexVar0 = &H10: V+ ON, 12V unchanged
l
hexVar0 = &H11 : V+ ON, 12V ON
l
hexVar0 = &H22: V+ OFF, 12V OFF
See
Example using switched relay power
(p. 48) for an example of how to write programs in
CRBasic to turn the switched relay power on and off.
The normal serial port instructions such as
SerialOpen()
and
SerialIn()
are used with the
SDM-SIO2R to send and receive data. Aside from changes to the
COMPort
and the
SerialOpenFormat
parameter, a program written for a standard serial port will usually work
with the SDM-SIO2R. 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-SIO2R to the data logger
(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-SIO2R.
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
See
(p. 45) for two simple examples of how to write programs in
CRBasic to send and receive data using the SDM-SIO2R.
Please contact Campbell Scientific for further assistance or training. The Campbell Scientific 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-SIO2R are listed in the following sections. Any other parameters should be
taken as not having changed. Please refer to the data logger 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-SIO2R 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.
SDM-SIO2R Serial Input/Output Module with Switched Sensor Power
27