Campbell Scientific SDM-SIO4 User Manual

INSTRUCTION MANUAL
SDM-SIO4 4-Channel
Serial I/O Interface
Revision: 2/04
Copyright (c) 1996-2004
Campbell Scientific, Inc.

Warranty and Assistance

Products may not be returned without prior authorization. The following contact information is for US and International customers residing in countries served by Campbell Scientific, Inc. directly. Affiliate companies handle repairs for customers within their territories. Please visit www.campbellsci.com to determine which Campbell Scientific company serves your country. To obtain a Returned Materials Authorization (RMA), contact CAMPBELL SCIENTIFIC, INC., phone (435) 753-2342. After an applications engineer determines the nature of the problem, an RMA number will be issued. Please write this number clearly on the outside of the shipping container. CAMPBELL SCIENTIFIC's shipping address is:
CAMPBELL SCIENTIFIC, INC.
RMA#_____ 815 West 1800 North Logan, Utah 84321-1784
CAMPBELL SCIENTIFIC, INC. does not accept collect calls.
SDM-SIO4 Table of Contents
PDF viewers note: These page numbers refer to the printed version of this document. Use the Adobe Acrobat® bookmarks tab for links to specific sections.
1. Introduction....................................................................
1.1 What is the SDM-SIO4?....................................................................... 1-1
1.2 Specifications........................................................................................ 1-3
1.2.1 Serial Ports.................................................................................. 1-3
1.2.2 SDM Port.................................................................................... 1-4
1.2.3 Case............................................................................................. 1-4
1.2.4 Power Requirements................................................................... 1-4
1.2.5 Environmental Operating Range................................................. 1-5
1.2.6 Other Key Features ..................................................................... 1-5
1.3 'Talk-Through' Mode............................................................................ 1-5
2. Installation and Hardware Set-Up ...........................2-1
2.1 Setting the SDM Address ..................................................................... 2-1
2.2 Selecting RS232 or 5V Logic for Each Port......................................... 2-2
2.3 Connections to the SDM-SIO4............................................................. 2-2
2.3.1 Transient Protection and Grounding........................................... 2-2
2.4 Power-on Tests — the Status LED....................................................... 2-3
3. Understanding How the SDM-SIO4 Handles Data .3-1
3.1 Introduction........................................................................................... 3-1
3.1.1 Method of Entering Special / Control Characters....................... 3-1
3.2 Input Filters........................................................................................... 3-2
3.2.1 Filter Types................................................................................. 3-2
3.3 Output Formatting.................................................................................3-6
3.3.1 Simple Output Formatter............................................................. 3-6
3.3.2 Output Format Strings................................................................. 3-7
4. Programming the SDM-SIO4....................................4-1
4.1 Command Line Operation and Structure.............................................. 4-1
4.2 Entering Commands............................................................................. 4-1
4.3 Basic Commands.................................................................................. 4-2
4.4 Advanced Commands........................................................................... 4-3
5. Programming the Datalogger ..................................5-1
5.1 Instruction 113 Parameters ................................................................... 5-1
5.1.1 Parameter 1 — Reps ................................................................... 5-1
5.1.2 Parameter 2 — Address.............................................................. 5-1
5.1.3 Parameter 3 — Mode.................................................................. 5-1
5.1.4 Parameters 4, 5 and 6 — SDM-SIO4 Command........................ 5-2
5.1.5 Parameter 7 — Values per Rep................................................... 5-2
5.1.6 Parameter 8 — Starting Input Location...................................... 5-2
5.1.7 Parameters 9 and 10 — Multiplier and Offset ............................ 5-2
i
SDM-SIO4 Table of Contents
5.2 Commands and Options (Parameters 4, 5 and 6)..................................5-2
5.2.1 Understanding Parameter Options and Returned Values ............5-3
5.2.2 Command 1: Poll of Available Data...........................................5-3
5.2.3 Command 2: Signatures............................................................. 5-4
5.2.4 Command 3: Flush all Receive Buffers......................................5-4
5.2.5 Command 4: Send Data to Datalogger.......................................5-4
5.2.6 Command 5: Status....................................................................5-4
5.2.7 Command 6: Flush Transmit Buffer...........................................5-5
5.2.8 Command 7: Activate Command Line.......................................5-5
5.2.9 Command 8: Poll Tx Buffers for Data .......................................5-5
5.2.10 Command 9: Flush Converted Data Buffer.............................. 5-6
5.2.11 Command 66: Send Single-Byte Data to Datalogger................5-6
5.2.12 Command 67: Get Return Code...............................................5-6
5.2.13 Command 320: Send Data to SDM-SIO4 .................................5-6
5.2.14 Command 321: Execute Command Line Command................5-6
5.2.15 Command 1024: Send String to Device...................................5-9
5.2.16 Command 1025: Transmit a Byte.............................................5-9
5.2.17 Command 1026: Serial Port Status...........................................5-9
5.2.18 Command 1027: ‘Manual’ Handshake Mode.........................5-11
5.2.19 Command 2049: Set Communications Parameters .................5-11
5.2.20 Command 2054: Set Up Receive Filter..................................5-13
5.2.21 Command 2304: Transmit String and/or Data to Device.......5-13
5.2.22 Command 2305: Transmit Byte(s).........................................5-15
5.3 SDM-SIO4 Configuration Examples.................................................5-15
5.3.1 Sensors Where the Datalogger Can Request Data by Sending a
Prompt or Using a Handshaking Line:................................................5-17
5.3.2 Sensors Which Send Data Out Without Prompting...................5-20
5.4 Outputting Datalogger Data................................................................5-27
5.5 Flushing the Input and Output Buffers................................................5-29
5.6 Return Error Codes.............................................................................5-29
6. Data Error Detection................................................ 6-1
6.1 Error detection with the SDM-SIO4 .....................................................6-1
6.2 Received Data....................................................................................... 6-1
6.2.1 Example of Using Received Data Filters.....................................6-3
6.2.2 CR10X Program Example...........................................................6-4
6.3 Transmitted Data...................................................................................6-7
6.3.1 Example of Using Transmitted Data Filters................................6-8
6.3.2 CR10X Program Example...........................................................6-8
6.3.3 Alternative CR10X Program.......................................................6-9
Appendices
Appendix A. ASCII Table.............................................A-1
Appendix B. Serial Port Data Transfer Modes...........B-1
B.1 Baud Rates........................................................................................... B-1
B.2 Stop Bits.............................................................................................. B-1
B.3 Data Length......................................................................................... B-1
B.4 Parity Bits............................................................................................ B-2
B.5 Serial Handshake Modes..................................................................... B-2
ii
SDM-SIO4 Table of Contents
Appendix C. Limitations of the Talk-Through Mode.C-1
C.1 Limitations...........................................................................................C-1
Figures
1-1. Schematic Diagram of the SDM-SIO4................................................ 1-2
Tables
1-1. SDM-SIO4 Serial Port Pin Configuration........................................... 1-3
2-1. Address Settings.................................................................................. 2-1
2-2. Status LED Error Codes...................................................................... 2-3
3-1. Fixed Strings Currently Allocated....................................................... 3-8
iii
SDM-SIO4 Table of Contents
This is a blank page.
iv

Section 1. Introduction

The SDM-SIO4 has four configurable serial RS232 ports which allow it to be connected to intelligent serial sensors, display boards, printers or satellite links. It can also be used in many other applications where the data is transferred in a serial fashion. This device is designed to send data to and receive data from the sensors, and process it in parallel with the datalogger’s own program sequence, thus making the complete datalogging system faster and more efficient.
The SDM-SIO4 can handle the incoming and outgoing data in many different ways. It can either send data in the same format as sent from the datalogger or it can be programmed to send pre-stored data strings to the sensor. Combinations of data sent from the datalogger and pre-stored strings can be sent, allowing complex formatted data to be sent. For input, the SDM-SIO4 can transfer data in the same form as received from a sensor to the datalogger, or it can be programmed to filter out critical data from a sensor and only pass back the data the datalogger requires.
NOTE
This manual assumes that you have a basic knowledge of the terminology and theory of serial communications. For further information please refer to one of the standard textbooks on this subject.

1.1 What is the SDM-SIO4?

The SDM-SIO4 i s a device that is connected to a datalogger through the datalogger SDM port. The SDM port is specific to Campbell Scientific dataloggers and acts as a high-speed data exchange mechanism. On some dataloggers it is a dedicated port; on others it is implemented using control ports C1, C2 and C3.
Figure 1-1, on the next page, is a Schematic Diagram giving an overview of the functions of the SDM-SIO4. When used in conjunction with the following sections of this manual, it may help you to understand how the SDM-SIO4 operates.
The datalogger program controls the sequence and timing of data exchange with the sensors. However, unlike most other Campbell Scientific interfaces the SDM-SIO4 can be configured in two ways:
1. By inserting commands in the datalogger program
2. By connecting a computer running a terminal emulation program to serial
port 1 on the SDM-SIO4. Pressing a switch on the SDM-SIO4 temporarily switches this port to allow you to access a ‘command line’ (for entering command strings in much the same way as entering commands at the DOS prompt on a PC).
The ‘command line’ option allows you to store complex output strings and data filters in the SDM-SIO4. This set-up information is stored in battery-backed,
1-1
Section 1. Introduction
g
write-protected memory, which allows you to set up the SDM-SIO4 in the office and then move it to the site of installation in an unpowered state.
Handshake Line
Handshake
Control
To Other Ports
½ ¾
¿
PORT
Rx
¿
Tx
Tx Buffer Rx Buffer
¿
0
1
¿ À
CRC/SIG
Driver
¿
¿
À
Format
Driver & User Strin
s
¾
À
1
0
½ ½
CRC/SIG
Driver
À
Filter Driver
À
Converted
Data Buffer
Switches -
Go to 1 if command
line active
¾
¿
À
Command Line
Switch
Status
LED
Command Line
Control
¿
Datalogger can
Execute Command
Line Commands
K K K
To Other Ports
À
¾
¾
½
Control Lines
Data Lines
FIGURE 1-1. Schematic Diagram of the SDM-SIO4
¿
Datalogger
Command
Control
¿ À
Data HS SDE C1 C2 C3
¿ ¿
to SDM port of datalogger
1-2

1.2 Specifications

1.2.1 Serial Ports

The SDM-SIO4 has four serial ports which can b e configured independently to use different serial data formats and baud rates (from 25 to 115,200 baud). These ports are 0-5V logic or ±5V for RS232 and are configured similar to a PC ‘AT’ style DTE serial port.
Handshaking, to control the flow of data to and from a sensor, can be done by the datalogger or SDM-SIO4 if needed, and can be in the form of hardware or software protocols.
Pin No. SDM-SIO4 Port
1. RI ring indicate/DCD in
2. RX in
3. TX out
4. DTR data terminal ready out
5. Ground
6. DSR in
7. RTS request to send out
8. CTS clear to send in
9. +5V if internal link fitted, otherwise no connection
Section 1. Introduction
TABLE 1-1. SDM-SIO4 Serial Port Pin Configuration
NOTE
Serial Port Buffers
If you have an older SDM-SIO4 which has female ‘D’ type connectors, your connections will be different from those shown above. Please either refer to your earlier Manual or contact Campbell Scientific for further details.
Each serial port has a receive (Rx) buffer, a transmit (Tx) buffer and a processed data storage buffer. It is important to understand these buffers as their size can determine how often data must be collected from the SDM-SIO4 by the datalogger. It is important to avoid letting these buffers fill up. They are of the ‘fill and stop’ type, i.e. if they fill up, and more data is sent into the buffer, the extra data will be lost.
The receive and transmit buffers for each port are 981 bytes long and there is an additional 16-byte hardware buffer for each port.
The processed data storage buffer (used to store converted data ready for the datalogger to collect) is 891 bytes long, which is large enough for 222 4-byte Campbell Scientific floating point values (refer to the datalogger manual for more details of this format).
1-3
Section 1. Introduction

1.2.2 SDM Port

There is one more buffer, which is used only when the datalogger outputs floating point data via the SDM-SIO4. This buffer is 241 bytes — long enough for 60 floating point values. (The size of this buffer is rarely a limitation as it is emptied quickly.)
This serial port is to connect to the SDM port of the datalogger, e.g. via C1, C2 and C3 on a CR10X. The port is a set of screw terminals marked C1, C2, C3, I/O, +12 and G. C3 is the Synchronous Device Enable line, C1 is the Data line, C2 is the Clock line and I/O is a special-purpose Interrupt line.
The Interrupt line can be used with some dataloggers to tell the datalogger to collect data from the sensor. The SDM-SIO4 pulses the I/O line for 50ms every 250ms if there is data available for the datalogger to collect. This can be used for sensors which send out data without prompting. For dataloggers which support interrupt-driven subroutines this can simplify program operation.
The SDM port is used by the datalogger to communicate with the SDM-SIO4 and other SDM peripherals. The speed at which data is transferred is under the control of the datalogger and this can vary with other activities in the datalogger and also the length of the SDM cables. The typical transfer speed to and from the SDM is one byte per millisecond.
Multiple SDM-SIO4s can be connected to the datalogger in parallel with other SDM-SIO4s or other SDM devices. The only difference would be the SDM address of each device.
NOTE
For high-speed c ommunications the SDM cable should be kept as short as possible and connections made using screened cable. The cable between the SDM-SIO4 and the datalogger should not exceed 3m in length.

1.2.3 Case

The case is made of anodized aluminum. It has four slots for 9-way ‘D’ connectors and one slot for the SDM 6-way screw terminals. There is a momentary push-button switch for command line activation. The size of the case is 184 x 88 x 34mm. There is a tab at each end to allow for vertical mounting.

1.2.4 Power Requirements

The SDM-SIO4 has a typical quiescent current consumption of about 0.7mA. This increases to about 29mA with all 4 ports active. The quiescent state is entered if there has been no SDM or port activity for approximately 30ms.
1-4
The unit can be powered from an unregulated 12V supply (acceptable range 9 ­18V DC).

1.2.5 Environmental Operating Range

-25°C to +50°C (contact Campbell Scientific for extended temperature
0 - 95% RH (non-condensing)

1.2.6 Other Key Features

An internal lithium battery which retains configuration information
(estimated life 10 years)
A built-in system watchdog which will reset the processor in the event of a
crash caused by transients, etc.
A multi-tasking operating system allowing concurrent transmission and
receipt of data on all ports. This allows the receipt and processing of data from all four serial ports concurrently at 9600 baud.
A built-in status LED to give an indication of system function on power-up.

1.3 ‘Talk-Through’ Mode

Section 1. Introduction
requirements)
Recent versions of the CR10X and CR23X datalogger operating systems allow a user, while connected to the datalogger, to switch to a ‘talk-thr ough’ mode via either a direct or a remote telecommunication connection. This allows users to communicate with a device connected to one of the four serial ports of the SDM-SIO4 as if they were directly connected to that device. This can be very useful for diagnosis or configuration of the remote device(s).
Users can also ‘talk through’ to access the command line mode of the SDM-SIO4, enabling them to check the status of, or even to reconfigure, an SDM-SIO4 via a remote connection.
Full details on using the command are given in the appropriate datalogger manual – see the section on ‘Telecommunication’.
See Appendix C of this manual for limitations on the use of the talk-through mode.
1-5
Section 1. Introduction
This is a blank page.
1-6

Section 2. Installation and Hardware Set-Up

The SDM-SIO4 is designed to be mounted on an enclosure chassis plate using the two mounting
Before installation, it is necessary to set up the address of the SDM-SIO4 and also the mode of operation of each serial port. These settings are determined by jumpers inside the case. To access these, remove the four M3 screws and lift the lid off. With the connectors facing you, you will see two blocks of jumpers on the right hand side of the circuit board.
holes in the tabs on the side of the case.
CAUTION
Turn off the 12V supply and take static prevention precautions before removing the lid.

2.1 Setting the SDM Address

The 4 x 2-way block of jumpers close to the ‘D’ connectors selects the SDM address of the SDM-SIO4. This address ranges from 0 to 15. The four selector blocks are numbered on the PCB silk screen as 1, 2, 4, and 8; ‘8’ is closest to the ‘D’ connectors. This is in binary format as shown in Table 2-1.
TABLE 2-1. Address Settings
Selector Block Settings SDM Address 8421
0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 0111 7 1000 8 1001 9 1010 10 1011 11 1100 12 1101 13 1110 14 1111 15
NOTE: A ‘1’ means the selector block shorts both pins. ‘0’ means the selector is only connected to one pin (for storage).
2-1
Section 2. Installation and Hardware Set-Up

2.2 Selecting RS232 or 5V Logic for Each Port

The output voltage levels of each serial port can be set to either:
Logic level output: +5V (high) / 0V (low) or
RS232 output: +5V (high) / -5V (low) (compatible with RS232 driver
requirements).
The logic level output is used when driving a logic level compatible device, e.g. an SC32A, or where quiescent current is a concern. This mode is lower power because the idle state is 0V, while the idle state of the RS232 output is -5V which results in current flow to ground via the input resistance of the RS232 device’s inputs. However, in practice, this logic level output mode can be used with the majority of RS232 sensors as most accept a logic level drive signal as a valid input signal.
The output levels are configured via a 4 x 3-way block of jumpers at the back of the unit. There is one jumper for each port. Text is printed on the circuit board to indicate the port and the relevant position for the two modes. If the jumper is fitted on (shorts) the two pins close to the right hand side of the unit, the port will be in RS232 mode and if the two pins close to the left hand side are shorted, the port is set to 5V logic.
The inputs to the SDM-SIO4 are compatible with either logic level or RS232 signals.

2.3 Connections to the SDM-SIO4

Connect the SDM port to the datalogger SDM terminals as described under ‘SDM Port’ in Section 1. Use a short, low-capacitance, screened cable. The 12V supply can normally be taken from the 12V supply input to the datalogger.
Make up cables for the RS232 devices to match the connections shown under ‘SDM-SIO4 Port’ in Table 1-1 (Section 1). Please refer to your sensor manual for a description of the required connections, including the handshaking requirements. To minimize susceptibility to noise, use screened connectors and cables.

2.3.1 Transient Protection and Groundi ng

The G terminal on the SDM-SIO4 acts both as a ground reference point for digital communications via the SDM port and also as a protective ground for the SDM-SIO4. Usually it can be connected back to the datalogger power ground (G on a CR10/10X). This ground in turn should be connected to the safety ground for the whole system.
The SDM-SIO4 has protection against electrostatic discharge and induced transients on all input and output lines. However, the level of protection offered is limited by the grounding paths within the case. Where long cables are to be run to remote serial devices, especially in areas prone to lightning, external
2-2
Section 2. Installation and Hardware Set-Up
lightning prote ction is recommended on a ll lines connected to the serial ports (contact Campbell Scientific for further details).
The possibility of ground loops being set up between the datalogger and the remote RS232 device via the serial cable should also be considered. Ground loops formed by secondary return earth paths can lead to various problems including:
Electrical noise causing possible loss or corruption of serial data.
Electrical noise being transferred back to the datalogger causing errors on
analogue measurements.
Long term damage in the form of corrosion caused by current flowing along
electro-chemical gradients.
If it is not possible to prevent a ground loop, or if electrical noise is found to be a problem, it may be necessary to add an opto-isolated interface to the output of the SDM-SIO4 serial port. Please contact Campbell Scientific for further details.
Even if ground loops can be prevented, the length of cables that can be used for RS232 signals is limited to a few tens of meters (the exact length depending on the RS232 driver hardware and the cable used). Short-haul modems can be added to the SDM-SIO4 to allow cables up to several kilometers to be used and in addition providing ground isolation (please contact Campbell Scientific for further details).

2.4 Power-on Tests — the Status LED

When the SDM-SIO4 is powered up or has been reset by the internal watchdog hardware it flashes the red LED on the front panel in the following way to indicate status:
TABLE 2-2. Status LED Err or Codes
No. of Flashes Description of error/status.
1 SDM-SIO4 is working correctly. 2 SDM-SIO4 EPROM signature failure. 3 SDM-SIO4 internal battery must be replaced.
NOTE 1: The LED flashes for 1 second on and 1 second off. The LED will also illuminate when the front panel switch is pressed.
NOTE 2: The LED may take up to 4 seconds before it flashes after power up.
2-3
Section 2. Installation and Hardware Set-Up
This is a blank page.
2-4

Section 3. Understanding How the SDM-SIO4 Handles Data

For simple applications the SDM-SIO4 can be configured and controlled from the datalogger alone, using the datalogger program instruction P113 (CR10X and CR7 dataloggers only). Future developments will include support for other dataloggers.
More complicated applications require configuration of the SDM-SIO4 using the ‘command line’ function on a PC running a terminal emulator. This allows you to set up mechanisms to control the transmission of long, formatted output data and filtering of numerical values out of received data. This is done by storing the detailed formatting and filtering configurations in the SDM-SIO4 (see the section about the command line mode below).
Thus when the datalogger needs to send out long or complicated data strings it only needs to send a short command to the SDM-SIO4 to tell it to do this, i.e. it does not have to pass the whole string via the SDM interface. Likewise, by telling the SDM-SIO4 how to process received data, it can strip off the unwanted characters and reduce the data to either binary or floating point numbers. This minimizes the time it takes for the datalogger to get the data and so allows the datalogger to load the data values into its memory with minimal processing.

3.1 Introduction

3.1.1 Method of Entering Special / Contr ol Characters

For collection of data from an intelligent sensor the datalogger programming is typically broken down into several steps, which might be:
1. Set up and co nfigure the serial ports , e.g. baud rate, parity, handshaking.
This can be done by one call of the datalogger instruction either at program compilation (so it is done only once) or perhaps in a subroutine which is called when a flag is toggled.
2. Use a second call of the instruction to tell the SDM-SIO4 to send out a
string to request data from a sensor and to tell it how to process the returned data.
3. At some point later in the program use a third call to collect the pre-
processed data from the SDM-SIO4.
Before examining the detail of the datalogger instruction it is necessary to understand the data output formatter and the input filters. These work in principle (and in certain details) like the formatting and filtering options used to write and read data from files in some high-level programming languages.
Before going on to discuss filters, you should understand how to enter special / control characters.
3-1
Section 3. Understanding How the SDM-SIO4 Handles Data
To enter a control character in the range of 0-255 decimal in a filter string, formatter string or a user string you must use the ‘&hh’ format, where ‘&’ defines the following two characters, ‘hh’, to be a hexadecimal number between 00 and FF. For example, ‘&de’ would be character 222 decimal. To use ‘&’ within the string you must type ‘&&’ (i.e. && = & when in a string).
NOTE

3.2 Input Filters

The hex. number must always be two ASCII characters.
Control characters can be entered for all commands in a similar way:
^M is carriage return, ^J line feed etc.
^^ means ^
"" means "
]] means ]
&& means &
&0d means line feed
&hex,hex used to enter 2-character hex. codes (0-9, A-F)
Input filters are used to convert received data into a form that is easy for the datalogger to process. Filters are generally used to strip out the required values from other, unnecessary, data transmitted from the sensor/device. The filters will also convert the required data into a form that the datalogger can use.
For example, the sensor may output the (unusual) complex str i ng ‘Sample data +12.3, 23.567,0xAB,12.4’. From this string you may only require to record the hexadecimal number 0xAB. A filter can be set up to strip out only this number, and then convert it to a 4-byte floating point number which the datalogger can use. The datalogger will then collect this value and place it into an input location –in this case as 171 decimal.
3-2
NOTE
You must always set up a filter if you want the datalogger to collect data from the SDM-SIO4.

3.2.1 Filter Types

Simple Filters
These filters can be set up by the datalogger program, i.e. command line set-up is not necessary. The four filters search for a specific data type to convert to Campbell Scientific floating point format. The SDM-SIO4 continues searching and reading data until it encounters a termination character (if this has been specified in Instruction 113) The filters are as follows:-
Search for an ASCII floating point number t o convert to Campbell
Scientific floating point format.*
Filter Strings
Section 3. Understanding How the SDM-SIO4 Handles Data
Search for an ASCII hex pair to convert to Campbell Scientific floating
point format.*
Search for an 8-bit binary number to convert to Campbell Scientific floating
point format.
Search for a 16-bit binary number to convert to Campbell Scientific floating
point format.
* Non-numeric characters are ignored.
See Section 5 – ‘Programming the Datalogger’.
These are used to define how to filter incoming data from a port into a format the datalogger can use. This is done by having a user-defined filter string pre­stored in the battery-backed memory of the SDM-SIO4. These strings have to be created via the command line (see Section 4), in a similar fashion to the format strings. The filter commands are as follows:
An Define a filter time-out. The range is from 0 to 255 in 50ms steps,
giving a range of 0 to 12.75 seconds. The accuracy is -50ms +0ms so an ‘n’value of 1 is not practical as the time-out could be between 0 and 50ms. This filter type can be put anywhere in the string. If a time-out occurs before the entire filter is complete, any data already processed is disregarded and the filter is restarted. When the filter string is finished the time-out is stopped and set to zero. If n=0 then this stops the time-out and the filter will operate with no time-out. While the time-out is active the SDM-SIO4 will not shut down into the low power state unless the filter is complete or the time-out has finished. Note it best to start the time-out after a trigger command.
B[n,n,n,...] Carry out a bit field to floating point conversion. The
SDM-SIO4 gets or waits for as many bytes as are required to fulfil the total number of bit fields. ‘n’ can be any number of bits from 0 to 255, but more than 23 bits is beyond the floating point range of the datalogger so the value returned to the datalogger will be invalid. There can be any number of bit fields, only limited by the command line buffer and the 255-byte limit for string storage. If there is part of a byte unconverted and there are no more bit fields remaining then those bits are discarded.
bn A binary number should be at this position. The SDM-SIO4 converts
‘n’ bytes (1, 2 or 3 bytes) to Campbell Scientific floating point.
C Discard one byte (character).
c Read one byte (not converted to Campbell Scientific floating point).
D A signed integer should be at this position. If it is found, the signed
integer is sent to the datalogger and removed from the buffer. If no signed integer is found, the SDM-SIO4 sends -99999 to the datalogger.
d Search for a si gned integer indefinitel y, ski pping non-numeric
characters.
3-3
Section 3. Understanding How the SDM-SIO4 Handles Data
e[ ] Scan until any ASCII character not entered between the brackets is
encountered. The maximum number of non-trigger characters is 255. Note that this filter does not remove the non-matching character from the buffer.
F A floating point number should be at this position. If it is found, the
signed floating point number is sent to the d atalogger and removed from the buffer. If no floating point number is found, the SDM-SIO4 sends -99999 to the datalogger.
f Search for a floating point number indefinitely, skipping a ny non-
numeric characters.
gn Error detection – start of signature calculation for received data – see
Section 6.
Gn Error detection – marks end of signature calculation for received data
– see Section 6.
i[ ] Scan until any ASCII characters entered between the brackets are
encountered. The maximum number of characters between the brackets is
255. Note that this filter does not remove the matched character from the buffer.
Jx:y ‘J’ deals with signed and unsi gned integers,
‘x’ is the number of characters or digits per integer (1 to 255) and y is the number of repetitions (1 to 255). Leading spaces and the signs ‘+’ and ‘-’ are allowed befo re the number but any integer which contains non-numeric characters (e.g. 23A5) will produce an error and return -99999.
nn Discard ‘n’ bytes. ‘n’ can be in the range of 0-255.
Nn Read ‘n’ bytes. ‘n’ can be in the range of 0-255 (not converted to
Campbell Scientific floating point).
pn Hexadecimal byte should be here, n=number of bytes to convert (n=1
to 3 hex pairs) to Campbell Scientific floating point.
Pn Converts hexadecimal value(s) to Campbell Scientific floating point
format. n=1,2,3 number of hex. pairs to convert into value LSByte first.
rn Send the byte received to port ‘n’ for re-transmission. ‘n’ can be
1-4. The byte is removed from the receive buffer.
s Stop the filter until commanded by the datalogger to restart.
t[ ] Search for an exact string match between the [ ]. All ASCII characters
up to and including the matching string are removed from the receive buffer before the next filter type starts.
T[ ] Search for an exact string match between the [ ]. All ASCII characters
up to the matching string are removed from the receive buffer before the next filter type starts. (Same as t[ ], except matching strings are not removed).
u[ ] Convert ASCII floating point into Campbell Scientific floating point
format until the termination character/string between [ ] is seen. The termination character is removed from the buffer.
3-4
Section 3. Understanding How the SDM-SIO4 Handles Data
vn[ ] Convert ‘n’ ASCII hex pairs into Campbell Scientific floating point
format until the termination character/string between [ ] is seen. ‘n’ can be 1-3. The termination character/string is removed from the buffer.
Vn Searches for hexadecimal value(s) and converts them to Campbell
Scientific floating point format. Terminates when a string between [ ] is seen. n=1,2, 3 number of hexadecimal pair s to convert into value LSB yte first.
wn[ ]Convert ‘n’-byte binary data into Campbell Scientific floating point
format until the termination character/string between [ ] is seen. ‘n’ can be 1-3. The termination character/string is removed from the buffer.
Wn Searches for binary value(s) and converts them to Campbell Scientific
floating point format. Terminates when a string between [ ] is seen. n=1,2,3 number of hexadecimal pairs to convert into value LSByte first.
x This marks the start of a data set. A data set is a set of converted data
for the datalogger to collect. When this filter type is used the data in the data set is only available to the datalogger when all parts of the data set have been converted – see ‘X’, below.
X This marks the end of a data set. This makes the data converted in the
data set available to the datalogger. This also means that data after this is available to the datalogger as soon as the SDM-SIO4 has converted each value. If the end of the data set is at the end of the filter string then this filter is not required as the end of the filter string is always the end of a data set.
Yn Converts binary value(s) to Campbell Scientific floating point format.
n=1,2,3 number of bytes to convert into value LSByte first.
z Flush the UART FIFO (serial port hardware buffer) and the Receive
buffer associated with the port that is using this filter type. This does not, however, clear the converted data buffer.
As an example, take the following sensor output string:
battery 12.65V,current 12mA
The filter string might be:
i[b]n8Fi[c]n8F
Output to the datalogger would be 12.65 and 12 as Campbell Scientific floating point numbers. This filter string works as follows:
1. i[b] waits for the trigger character ‘b’ of ‘battery’.
2. n8 discards everything up to 12.65V.
3. F converts the number to Campbell Scientific floating point. If a valid
number is not found -99999 is sent to the datalogger.
4. i[c] waits for the trigger character ‘c’ of ‘current’.
5. n8 discards everything up to 12mA.
6. F converts the number to Campbell Scientific floating point. If a number is
not found -99999 is sent to the datalogger.
This filter will repeat the above operations on all incoming values.
3-5
Section 3. Understanding How the SDM-SIO4 Handles Data
Predefined Filter Strings
A small number of fixed filter strings are pre-defined as follows:
Filter No. Filter String Used
256 r1 257 r2 258 r3 259 r4

3.3 Output Formatting

The output formatters are used to format data from the datalogger into English text messages, send strings/ commands to sensors and to outp ut t ext to a display.
For example, you may have a display on which you want to show air temperature and humidity. The datalogger would take the measurements from the sensors, and place two values into appropriate input locations. It would be impractical for the datalogger to store text labels in this way, and so you could use the SDM-SIO4 to send a label to the display along with the data from the datalogger.
The final result may be displayed as:
The temperature is 23.7C The humidity is 65.8%
The string generated would then be transmitted from the selected serial port. Because the formatter is programmable, almost any string can be output from the serial port, either by programming the datalogger or by using the command line.

3.3.1 Simple Output Formatter

This can be set up by the datalogger and allows data to be transmitted out of the SDM-SIO4 in a number of simple formats. It is not necessary to use the command line mode to use these formats. Simple output formats are as follows:
Convert a location sent into ASCII floating point. If this option is selected
an extra ASCII character/delimiter can be added to the end of the ASCII number sent.
Convert a location sent into an ASCII hex pair. If this option is selected an
extra ASCII character/delimiter can be added to the end of the hex number sent.
Convert a location sent into an 8-bit binary byte. If this option is selected an
extra ASCII character/delimiter can be added to the end of the byte sent.
3-6
Convert a location sent into a 16-bit binary word. If this option is selected
an extra ASCII character/delimiter can be added to the end of the 16-bit word sent.
See Section 5 – ‘Programming the Datalogger’.
Section 3. Understanding How the SDM-SIO4 Handles Data

3.3.2 Output Format Strings

These allow either just long strings to be sent from the SDM-SIO4 or a combination of string data plus data from a datalogger input location. This type of format is normally set up from the ‘command line’. The user definable strings are referenced by a number in the range 0..255. The string is entered as a series of the following formatter commands:
<space> Send ASCII space.
bn Send a binary number received from the datalogger to the port. ‘n’ can
be 1, 2 or 3 bytes, i.e. 8-, 16- or 24-bit. If n=4 then it is direct Campbell
Scientific floating point format. If the formatter string asks for more values than the datalogger sends then the SDM-SIO4 sends ‘*’ characters.
fn:n Send a left-hand justified, formatted ASCII floating point number to
the port. The first ‘n’ is the field width in characters and the second ‘n’ is the number of decimal places to use within the field width. If the integer part of the ‘n’ number is bigger than the field width, the SDM-SIO4 still sends it even though it is longer tha n the set field width. If the formatter string asks for more values than the datalogger sends (because Instruction 113 specifies fewer values) then the SDM-SIO4 sends a number of ‘*’ characters to the port (e.g. for a fiel d width of 4 it sends ****). Minimum fi eld width 2 digits, maximum field width 15 characters, maximum number of decimal places 8.
gn Error detection – start of signature calculation for transmitted data –
see Section 6.
Gn Error d etection – marks end of signature calculation for transmitted
data – see Section 6.
hn Send an ASCII hex number to the port. ‘n’ can be 1, 2 or 3 bytes
converted, i.e. an 8-, 16- or 24-bit number. If the formatter string asks for more values than the datalogger sends then the SDM-SIO4 sends
‘*’ characters.
i[ ] Send the string between the brackets [ ] to the port. Up to 255 ASCII characters can be sent. (See Section 4.2 – Entering Commands).
J Send line feed.
M Send carriage return.
s Stop formatting.
zn Send a pre-stored string to the port. ‘n’ is the user-defined string
number 0-255 or a fixed string 256-511.
Table 3-1, below, shows all the defined Fixed Strings.
3-7
Section 3. Understanding How the SDM-SIO4 Handles Data
TABLE 3-1. Fixed Strings Currently Allocated
String number String (enclosed in quotes)
256 ‘+0000000000123.45670000000000CrLf’ 257 ‘Voltage’ 258 ‘Amps’ 259 ‘Watts’ 260 ‘Joules’ 261 ‘Temperature’ 262 ‘Pressure’ 263 ‘Speed’ 264 ‘Power’ 265 ‘Depth’ 266 ‘Length’ 267 ‘Height’ 268 ‘Enter’ 269 ‘Password’ 270 ‘Correct’ 271 ‘Incorrect’ 272 ‘Overrange’ 273 The ASCII characters: carriage return, linefeed.
If the datalogger sends more data than is defined in the SDM-SIO4’s formatter string, the SDM-SIO4 starts at the beginning again unle ss ‘s’ (stop formatting) is used, in which case any extra data within that transmission is ignored.
CR10X Program Example
This program example will output the battery voltage and panel temperature received from the datalogger input locations to port 2 on the SDM-SIO4, using the SDM-SIO4 Output Formatter.
The user defined format string, which is entered in the command line mode (see Section 4), is as follows:-
fmtst 123 "z261 f6:2 i[Battery ]z257 f6:1z273"
Typical example output from this formatter string is:-
Temperature 27.23 Battery Voltage 12.6
Here is a description of what each part of the formatter does:­fmtst 123 – This is the command word for storing the formatter string in area
123.
z261 – This outputs the fixed string ‘Temperature’. space – This outputs an ASCII space.
3-8
f6:2 – This takes the value from location 1 and outputs it in a field with a total width of 6 characters. There are 2 decimal places available within the field.
space – This outputs an ASCII space.
Section 3. Understanding How the SDM-SIO4 Handles Data
i[Battery ] – This outputs the word between the brackets [ ]. z257 – This outputs the fixed string ‘Voltage’. space – This outputs an ASCII space. f6:1 – This takes the value from location 2 and outputs it in a field with a total
width of 6 characters. There is 1 decimal place available within the field. z273 – This outputs the fixed string ‘CrLf (carriage return line feed)’.
*Table 1 Program
01: 2 Execution Interval (seconds)
;get battery voltage.
1: Batt Voltage (P10)
1: 2 Loc [ Batt_v ]
;get panel temperature.
2: Internal Temperature (P17)
1: 1 Loc [ Temp_C ]
;send battery voltage and temperature to port 2 on the SDM-SIO4.
3: SDM-SIO4 (P113)
1: 1 Reps 2: 0 Address 3: 2 Send/Receive Port 2 4: 2304 Command ;see Section 5 for explanation of 5: 9123 1st Parameters ;Command 2304 and its Parameters 6: 0 2nd Parameters ; 7: 2 Values per Rep 8: 1 Loc [ Temp_c ] 9: 1.0 Mult 10: 0.0 Offset
*Table 2 Program
02: 0.0000 Execution Interval (seconds)
*Table 3 Subroutines
End Program
3-9
Loading...
+ 57 hidden pages