Campbell Hausfeld SDM-SIO4 User Manual

SDM-SIO4
4-Channel Serial I/O
Interface
User Guide
Issued 17.3.97
Copyright
1997 Campbell Scientific Ltd.
This equipment is guaranteed against defects in materials, workmanship, and software. This guarantee applies for twelve months from date of delivery. We will repair or replace products which prove to be defective during the guarantee period provided they are returned to us prepaid. The guarantee will not apply to:
Equipment which has been modified or altered in any way without the
written permission of Campbell Scientific
Batteries
Any product which has been subjected to misuse, neglect, acts of God
or damage in transit.
Campbell Scientific will return guaranteed equipment by surface carrier prepaid. Campbell Scientific will not reimburse the claimant for costs incurred in removing and/or reinstalling equipment. This guarantee and the Company’s obligation thereunder is in lieu of all other guarantees, expressed or implied, including those of suitability and fitness for a particular purpose. Campbell Scientific is not liable for consequential damage.
Please inform us before returning equipment and obtain a Repair Refer­ence Number whether the repair is under guarantee or not. Please state the
faults as clearly as possible, and if the product is out of the guarantee period it should be accompanied by a purchase order. Quotations for re­pairs can be given on request.
When returning equipment, the Repair Reference Number must be clearly marked on the outside of the package.
Note that goods sent air freight are subject to Customs clearance fees which Campbell Scientific will charge to customers. In many cases, these charges are greater than the cost of the repair.
Campbell Scientific Ltd,
Campbell Park, 80 Hathern Road,
Shepshed, Leicestershire, LE12 9RP, UK
Tel: +44 (0) 1509 601141
Fax: +44 (0) 1509 601091
Email: support@campbellsci.co.uk
www.campbellsci.co.uk

Contents

Section 1. Introduction..................................................... 1-1
Section 2. Installation and Hardware Set-Up.................. 2-1
Section 3. Understanding How the SDM-SIO4 Handles
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-4
1.2.6 Other Key Features...............................................................................1-5
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
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-5
3.3.1 Simple Output Formatter ......................................................................3-5
3.3.2 String Output Formats ..........................................................................3-6
Section 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
Section 5. Programming the SDM-SIO4..........................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-1
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
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
i
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-5
5.2.11 Command 66: Send Single-Byte Data to Datalogger .........................5-5
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-8
5.2.16 Command 1025: Transmit a Byte......................................................5-8
5.2.17 Command 1026: Serial Port Status....................................................5-8
5.2.18 Command 1027: ‘Manual’ Handshake Mode .................................5-10
5.2.19 Command 2049: Set Communications Parameters ..........................5-10
5.2.20 Command 2054: Set Up Receive Filter...........................................5-12
5.2.21 Command 2304: Transmit String and/or Data to Device................5-12
5.2.22 Command 2305: Transmit Byte(s)..................................................5-14
5.3 SDM-SIO4 Configuration Examples ...........................................................5-14
5.3.1 Sensors Where the Datalogger Can Request Data by Sending a Prompt
or Using a Handshaking Line:............................................................5-16
5.3.2 Sensors Which Send Data Out Without Prompting............................5-18
5.4 Outputting Datalogger Data ......................................................................... 5-25
5.5 Flushing the Input and Output Buffers.........................................................5-26
5.6 Return Error Codes ......................................................................................5-26
Section 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-3
6.3 Transmitted Data............................................................................................6-6
6.3.1 Example of Using Transmitted Data Filters ......................................... 6-7
6.3.2 CR10X Program Example....................................................................6-8
6.3.3 Alternative CR10X Program ................................................................ 6-8
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
Figures
Tables
1. Schematic Diagram of the SDM-SIO4.............................................................1-2
1. SDM-SIO4 Serial Port Pin Configuration........................................................1-3
2. Address Settings............................................................................................... 2-1
3. Status LED Error Codes................................................................................... 2-3
4. Fixed Strings Currently Allocated....................................................................3-6
ii

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 is 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, 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:
By inserting commands in the datalogger program
1.
By connecting a computer running a terminal emulation program to
2. 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, 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.
1-1
SDM-SIO4 4-Channel Serial I/O Interface User Guide
Handshake Line
Handshake
Control
To Other Ports
½ ¾
¿
PORT
Rx
¿
Tx
Tx Buffer Rx Buffer
¿
0
1
¿ À
CRC/SIG
Driver
¿
¿
À
Format
Driver & User Strings
¾
½
À
0
1
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 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 be 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 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).
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.)
1-3
SDM-SIO4 4-Channel Serial I/O Interface User Guide
1.2.2 SDM Port
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 communications 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 anodised aluminium. 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.
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 requirements)
0 - 95% RH (non-condensing)
1-4
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.
Section 1 . Introduction
1-5

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.
Selector Block Settings SDM Address 8 4 2 1
0 0 0 0 0 0 0 0 1 1 0 0 1 0 2 0 0 1 1 3 0 1 0 0 4 0 1 0 1 5 0 1 1 0 6 0 1 1 1 7 1 0 0 0 8 1 0 0 1 9 1 0 1 0 10 1 0 1 1 11 1 1 0 0 12 1 1 0 1 13 1 1 1 0 14 1 1 1 1 15
Table 2 Address Settings
NOTE: A ‘1’ means the selector block shorts both pins. ‘0’ means the selector is only connected to one pin (for storage).
2-1
SDM-SIO4 User Guide
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
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.
requirements).
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 (Section 1). Please refer to your sensor manual for a description of the required connections, including the handshaking requirements. To minimise susceptibility to noise, use screened connectors and cables.
2.3.1 Transient Protection and Grounding
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 lightning protection is recommended on all lines connected to the serial ports (contact Campbell Scientific for further details).
2-2
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:
Section 2. Installation and Hardware Set-Up
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 metres (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 kilometres 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 3 Status LED Error 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 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 minimises 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
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 configure 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.
3.1.1 Method of Entering Special / Contr ol Char acters
Before going on to discuss filters, you should understand how to enter special / control characters.
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).
3-1
SDM-SIO4 User Guide
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 string ‘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.
NOTE
3.2.1 Filter Types
Simple Filters
You must data from the SDM-SIO4.
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 to convert to Campbell Scientific
Search for an ASCII hex pair to convert to Campbell Scientific floating point
Search for an 8-bit binary number to convert to Campbell Scientific floating
Search for a 16-bit binary number to convert to Campbell Scientific floating
always
set up a filter if you want the datalogger to collect
floating point format.*
format.*
point format.
point format.
3-2
* Non-numeric characters are ignored.
Filter Strings
Section 3. Understanding How the SDM-SIO4 Handles Data
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 signed integer indefinitely, skipping non-numeric characters.
e[ ] Scan until any ASCII character
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 datalogger 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 any non-
numeric characters.
gn Error detection – start of signature calculation for received data – see
Section 6.
not
entered between the brackets is
Gn Error detection – marks end of signature calculation for received data
– see Section 6.
3-3
SDM-SIO4 User Guide
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.
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.
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.
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.
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.
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.
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.
3-4
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’.
Predefined Filter Strings
Section 3. Understanding How the SDM-SIO4 Handles Data
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.
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 output text 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-5
SDM-SIO4 User Guide
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’.
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 than 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 field width of 4 it sends ****). Minimum field 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 detection – 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 4, below, shows all the defined Fixed Strings.
3-6
Loading...
+ 50 hidden pages