Campbell SDM-SIO4 User Manual - 1.2

Other manuals for SDM-SIO4: Instruction Manual
Manual is about: 4-channel serial I/O Interface

Summary of SDM-SIO4

  • Page 1

    Sdm-sio4 4-channel serial i/o interface user guide issued 17.3.97 copyright 1997 campbell scientific ltd..

  • Page 3: Guarantee

    Guarantee 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 gua...

  • Page 5: Contents

    I contents section 1. Introduction ..................................................... 1-1 1.1 what is the sdm-sio4?.................................................................................1-1 1.2 specifications .................................................................................

  • Page 6

    Ii 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 co...

  • Page 7: Section 1.  Introduction

    1-1 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 i...

  • Page 8

    Sdm-sio4 4-channel serial i/o interface user guide 1-2 ¿ ¾ ½ ¾ ¿ À ¿ À ¾ switches - go to 1 if command line active ½ ½ ½ ¾ ¾ ¿ ¿ ¿ ¿ ¿ ¿ ¿ À À À À À ¿ ¿ to other ports to other ports 1 À port handshake control tx buffer rx buffer command line control datalogger command control crc/sig driver format ...

  • Page 9: 1.2

    Section 1 . Introduction 1-3 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 ‘a...

  • Page 10

    Sdm-sio4 4-channel serial i/o interface user guide 1-4 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 ...

  • Page 11

    Section 1 . Introduction 1-5 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 allo...

  • Page 13: Set-Up

    2-1 section 2. Installation and hardware set-up the sdm - sio4 is designed to be mounted on an enclosure chassis plate using the two mounting holes in the tabs on the side of the case . Before installation, it is necessary to set up the address of the sdm-sio4 and also the mode of operation of each ...

  • Page 14

    Sdm-sio4 user guide 2-2 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 ...

  • Page 15

    Section 2. Installation and hardware set-up 2-3 • 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 elec...

  • Page 17: Sdm-Sio4 Handles Data

    3-1 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. ...

  • Page 18: 3.2  Input Filters

    Sdm-sio4 user guide 3-2 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 ...

  • Page 19

    Section 3. Understanding how the sdm-sio4 handles data 3-3 see section 5 – ‘programming the datalogger’. Filter strings 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...

  • Page 20

    Sdm-sio4 user guide 3-4 • 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. • n n discard ‘n’ bytes. ‘n’ can be in the range of ...

  • Page 21: 3.3  Output Formatting

    Section 3. Understanding how the sdm-sio4 handles data 3-5 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...

  • Page 22

    Sdm-sio4 user guide 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’. 3.3.2 output format strings these allow either just long strings t...

  • Page 23

    Section 3. Understanding how the sdm-sio4 handles data 3-7 table 4 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...

  • Page 24

    Sdm-sio4 user guide 3-8 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...

  • Page 25: 4.2  Entering Commands

    4-1 section 4. Programming the sdm-sio4 this section gives both the basic commands and advanced command line options which allow testing and advanced configuration of the sdm-sio4. 4.1 command line operation and structure to use the command line mode, connect a computer to port 1 of the sdm-sio4. Th...

  • Page 26: 4.3  Basic Commands

    Sdm-sio4 user guide 4- 2 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) 4.3 basic commands fltst [stri...

  • Page 27: 4.4  Advanced Commands

    Section 4. Programming the sdm-sio4 4-3 because they are compiled. Exit this command exits the command line and returns port 1 of the sdm-sio4 to normal operation. 4.4 advanced commands version this returns the internal eprom part number, signature and the string signature if good or 0 if bad. This ...

  • Page 28

    Sdm-sio4 user guide 4- 4 wd n wderr n wdaddr n wd n is a count of the number of watchdog resets, wderr is the number of the last task that crashed and wdaddr is the address at which the crash was found. Nc 0-9 this is the number of sdm commands the datalogger sent to the sdm-sio4 that the sdm-sio4 d...

  • Page 29

    Section 4. Programming the sdm-sio4 4-5 testio [test#] this is used by campbell scientific for test purposes. Each test command is carried out for 2 seconds. Test# can be in the range 0-255; only five test numbers are currently valid, as shown below. Testio returns test 0 dtr,rts,io=low test1 dtr=hi...

  • Page 31

    5-1 section 5. Programming the datalogger the datalogger instruction specific to the sdm-sio4 is p113 (cr7 and cr10/10x only). (please check with campbell scientific to see if your version of the operating system supports this.) the instruction has the following format: parameter no. Description 01 ...

  • Page 32

    Sdm-sio4 user guide 5-2 5.1.5 parameter 7 — values per rep this determines how many values to send or receive, starting from the specified input location (parameter 8). Data can be either 4-byte floating point values or single bytes, determined by the sdm-sio4 command number. Some commands require n...

  • Page 33

    Section 5. Programming the datalogger 5-3 5.2.1 understanding parameter options and returned values in the following examples, ‘x’ indicates a single digit from 0 to 9. When the command requires or returns values, each digit, or combination of digits, can signify either a value, flag or setting. Usi...

  • Page 34

    Sdm-sio4 user guide 5-4 5.2.3 command 2: signatures this command gets the sdm-sio4 eprom signature and the string memory area signature; the two values are written into consecutive input locations. If the signatures are zero then there could be corrupt data. Values per repetition = 2 5.2.4 command 3...

  • Page 35

    Section 5. Programming the datalogger 5-5 if any of these four digits is greater than zero then data is available. Values per repetition = 2 5.2.7 command 6: flush transmit buffer this command flushes the sdm-sio4 transmit buffer of data it is waiting to send. Values per repetition = 0 5.2.8 command...

  • Page 36

    Sdm-sio4 user guide 5-6 5.2.12 command 67: get return code this command gets the return error code and places it into a specified location. Command 67 is used in conjunction with command 321 and provides a single return code value which indicates if the command was successful or not. See section 5.6...

  • Page 37

    Section 5. Programming the datalogger 5-7 p65 bulk load 1:102 f 2:108 l 3:116 t 4:115 s 5:116 t 6:32 ascii space 7:50 2 8:53 5 9:1 first location to store the first lot of 8 characters. P65 bulk load 1:32 ascii space 2:34 “ 3:102 f 4:102 f 5:67 c 6:99 c 7:34 “ 8:0 9:9 first location to store second ...

  • Page 38

    Sdm-sio4 user guide 5-8 ;set flag one so that set-up will only be done once. P86 11 ;end of set-up. P95 if you use the ramtest command you will have to wait a minimum of 6 seconds for it to complete before you try to execute another p113. Some dataloggers do not support p65 bulk load. In that case y...

  • Page 40

    Sdm-sio4 user guide 5-10 break reset: 0 do nothing 1 reset line break count to zero framing reset: 0 do nothing 1 reset framing error count to zero overrun reset: 0 do nothing 1 reset overrun error count to zero parity reset: 0 do nothing 1 reset parity error count to zero 5.2.18 command 1027: ‘manu...

  • Page 43

    Section 5. Programming the datalogger 5-13 output mode: 0 no output format string 1 convert location to ascii floating point. Add character/delimiter between values if enabled. The last value will not have a delimiter after it. 2 convert location to ascii hex pair. Add character/delimiter between va...

  • Page 44

    Sdm-sio4 user guide 5-14 5.2.22 command 2305: transmit byte(s) by using p113 command 2305 it is possible to transmit either one or two bytes from the command options. If any command option is set to 999 then the byte will not be sent. The number range for each command option is 0-255 and 999. An exa...

  • Page 45

    Section 5. Programming the datalogger 5-15 ;set serial mode to dtr, rts always set, ignore cts, 1 stop bit no parity, ;8 bit data length, 9600 baud and no handshake delay. 2: sdm-sio4 (p113) 1: 1 reps 2: 0 address 3: 1 send/receive port 1 4: 2049 command 5: 3146 1st parameters 6: 0 2nd parameters 7:...

  • Page 46

    Sdm-sio4 user guide 5-16 *table 2 program 02: 0.0000 execution interval (seconds) *table 3 subroutines end program the normal configuration would include setting the speed and serial data format by calling the datalogger instruction with command 2049 and the relevant parameters. For the majority of ...

  • Page 47

    Section 5. Programming the datalogger 5-17 ^j^m – this is a way of entering control characters for carriage return/linefeed into a string the following program example works as follows: 1. The first p113 sets up a simple filter to search for floating point numbers. 2. The first parameter of this com...

  • Page 48

    Sdm-sio4 user guide 5-18 ;get data from sdm-sio4 and put into locations 1 and 2. 3: sdm-sio4 (p113) 1: 1 reps 2: 0 address 3: 1 send/receive port 1 4: 4 command 5: 0 1st parameters 6: 0 2nd parameters 7: 2 values per rep 8: 1 loc [ number ] 9: 1.0 mult 10: 0.0 offset ;at zero minutes into a 10 minut...

  • Page 49

    Section 5. Programming the datalogger 5-19 example cr10x program without polling or interrupts this simple program is an example for sensors that send data at random intervals. If no data was available when the datalogger asked for it then -99999 will be put into locations 1 and 2. An if then struct...

  • Page 50

    Sdm-sio4 user guide 5-20 ;end of set up. 5: end (p95) ;get the two floating point values from the sdm-sio4. 6: sdm-sio4 (p113) 1: 1 reps 2: 0 address 3: 1 send/receive port 1 4: 4 command 5: 0 1st parameters 6: 0 2nd parameters 7: 2 values per rep 8: 1 loc [ voltage ] 9: 1.0 mult 10: 0.0 offset ;onl...

  • Page 51

    Section 5. Programming the datalogger 5-21 x – this filter marks the start of the data set. In this case the data set is two floating point numbers. F – this filter searches for the first ascii floating point number to convert. F – this filter searches for the second ascii floating point number to c...

  • Page 52

    Sdm-sio4 user guide 5-22 ;if value returned from poll is >=1 then data must be available. 7: if (xf) (p89) 1: 2 x loc [ poll ] 2: 3 >= 3: 1 f 4: 30 then do ;get voltages into locations 3 and 4 if poll was true. 8: sdm-sio4 (p113) 1: 1 reps 2: 0 address 3: 1 send/receive port 1 4: 4 command 5: 0 1st ...

  • Page 53

    Section 5. Programming the datalogger 5-23 – see ‘sdm port’ in section 1 for details. This should be connected to control port 8 for this example. A typical filter that could be used is as follows: fltst 200 "t[data]a5xff" this filter works as follows: t[data] – this filter waits for an exact string...

  • Page 54

    Sdm-sio4 user guide 5-24 ;end of if 6: end (p95) *table 2 program 02: 0.0000 execution interval (seconds) *table 3 subroutines ;interrupt routine for control port 8 1: beginning of subroutine (p85) 1: 98 subroutine 98 ;get voltages into locations 3 and 4 2: sdm-sio4 (p113) 1: 1 reps 2: 0 address 3: ...

  • Page 55

    Section 5. Programming the datalogger 5-25 5.4 outputting datalogger data the sdm-sio4 can be used to drive displays, printout devices and other output- only systems. In this case after the initial configuration (as above) either simple data can be sent using commands 0320, 1025 or just data strings...

  • Page 56: 5.6  Return Error Codes

    Sdm-sio4 user guide 5-26 *table 2 program 02: 0.0000 execution interval (seconds) *table 3 subroutines end program 5.5 flushing the input and output buffers one important aspect of the sdm-sio4 is that it will continue to collect data and store it in its buffers even if the datalogger program stops ...

  • Page 57: 6.2  Received Data

    6-1 section 6. Data error detection error detection by checksum, crc or signatures is a way of detecting errors in data, either transmitted or received. This section gives details on how to use filter strings together with datalogger program examples to implement error detection methods. 6.1 error d...

  • Page 58

    Sdm-sio4 user guide 6-2 3 crc16-ccitt-ibm (tag receiver). 4 crc32 standard. Polynomial x 32 +x 26 +x 23 +x 22 +x 16 +x 12 +x 11 +x 10 +x 8 +x 7 +x 5 +x 4 +x 2 +x+1. 5 csi signature (see appendix c of the cr10x manual). 6 checksum using modulo 256. 7 checksum using modulo 8192 (see section 5 of the c...

  • Page 59

    Section 6. Data error detection 6-3 6.2.1 example of using received data filters if a sensor transmitted the following string: frequency=12.34567hzbb3dcrlf then a user defined filter string would have to be used. The bb3d part of the string is the crc sent in hex. From the sensor. To produce a filte...

  • Page 60

    Sdm-sio4 user guide 6-4 *table 1 program 01: 1.0 execution interval (seconds) ;test flag 1 – if not set tell the sdm-sio4 to use filter string 100 1: if flag/port (p91) 1: 21 do if flag 1 is low 2: 30 then do ;tell the sdm-sio4 to use filter string 100 2: sdm-sio4 (p113) 1: 1 reps 2: 0 address 3: 1 ...

  • Page 61

    Section 6. Data error detection 6-5 ;if the value in location 1 is greater than zero then there must be data ;this assumes only one sensor is connected to the sdm-sio4 7: if (xf) (p89) 1: 1 x loc [ _________ ] 2: 3 >= 3: 1 f 4: 30 then do ;if data is available then get the value and put into locatio...

  • Page 62: 6.3  Transmitted Data

    Sdm-sio4 user guide 6-6 1,2 crc16 and crc16-ccitt 0.159ms/char. 3 crc16-ccitt-ibm 0.159ms/char. 4 crc32 0.369ms/char. 5 csi signature 0.077ms/char. 6 checksum using modulo 256 0.066ms/char. 7 checksum using modulo 8192 0.071ms/char. C the time for the different data types is shown below. Note that t...

  • Page 63

    Section 6. Data error detection 6-7 5 csi signature (cr10x user manual section c-4). 6 check sum using modulo 256. 7 check sum using modulo 8192 (cr10x user manual section 5-2). 8-255 reserved for future use. Gn this formatter type can be put into the formatter string to mark the end of the string a...

  • Page 64

    Sdm-sio4 user guide 6-8 6.3.2 cr10x program example a typical cr10x datalogger program to work with the above formatter is shown below. The program assumes that the sdm-sio4 is set to address 0, the sensor is connected to port 1 of the sdm-sio4 and the port settings, baud rate etc have been set. The...

  • Page 65

    Section 6. Data error detection 6-9 *table 1 program 01: 1.0 execution interval (seconds) ;use formatter string 100 to set up the crc16 on port 1 1: sdm-sio4 (p113) 1: 1 reps 2: 0 address 3: 1 send/receive port 1 4: 2304 command 5: 9100 1st parameters 6: 0 2nd parameters 7: 0 values per rep 8: 0000 ...

  • Page 66

    Sdm-sio4 user guide 6-10 ;use formatter string 102 and output datalogger location 1 as ascii floating point ;to port 1 and then output the calculated ascii hex crc16 6: sdm-sio4 (p113) 1: 1 reps 2: 0 address 3: 1 send/receive port 1 4: 2304 command 5: 9102 1st parameters 6: 0 2nd parameters 7: 1 val...

  • Page 67

    Section 6. Data error detection 6-11 1 8 bit binary 0.155ms 2,3 16 bit binary 0.216ms 4,5 32 bit binary 0.334ms 6 ascii decimal 1.125ms 7 8 bit ascii hex 0.226ms 8 16 bit ascii hex 0.355ms 9 32 bit ascii hex 0.613ms the above timings are preliminary. D with the crc32 and crc16-ccitt there is a extra...

  • Page 69: Appendix A.  Ascii Table

    A-1 appendix a. Ascii table american standard code for information interchange decimal values and characters (x3.4-1968) dec. Char. Dec. Char. Dec. Char. Dec. Char. 0 control @ 32 space 64 @ 96 ` 1 control a 33 ! 65 a 97 a 2 control b 34 " 66 b 98 b 3 control c 35 # 67 c 99 c 4 control d 36 $ 68 d 1...

  • Page 71: Modes

    B-1 appendix b. Serial port data transfer modes this appendix describes the serial port set-up in some detail. Please note that the numerical option codes vary between the command line set-up and the datalogger command set-up. The ones listed below are those for the command line mode. B.1 baud rates...

  • Page 72: B.4  Parity Bits

    Sdm-sio4 4-channel serial i/o interface b-2 b.4 parity bits parity can be enabled and set to either odd or even. 0. No parity set 1. Odd parity set 2. Even parity set b.5 serial handshake modes you can select different kinds of handshaking from none at all, hardware (dtr, cts etc.) and xon/xoff. On ...