background image

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 and the point at which the signature should be transmitted. It also sets the
data type to use. ‘n’ can be in the range of 0-255 which indicates the data type to
use. The data types that the SDM-SIO4 can deal with are as follows:

0

No data type or check.

1

8 bit binary. Expects 1 byte.

2

16 bit binary least significant byte first. Expects 2 bytes.

3

16 bit binary most significant byte first. Expects 2 bytes.

4

32 bit binary least significant byte first. Expects 4 bytes.

5

32 bit binary most significant byte first. Expects 4 bytes.

6

ASCII decimal. Waits until non ASCII 0-9 received.

7

8 bit ASCII hex. Expects 2 ASCII bytes, if not 0-9,a-f,A-F then fail.

8

16 bit ASCII hex. Expects 4 ASCII bytes, if not 0-9,a-f,A-F then fail.

9

32 bit ASCII hex. Expects 8 ASCII bytes, if not 0-9,a-f,A-F then fail.

10-255  reserved for future use.

6.3.1  Example of Using Transmitted Data Filters

A sensor requires the string ‘123456789’ but also requires a CRC16 appended to
the end in 16 bit ASCII Hex which, in this case, would be ‘123456789BB3D’.
The BB3D is the CRC16 calculated for the ‘123456789’ string.

You would need to define a formatter string to do this. One way would be by
using the command line. You would need to make a formatter string transmit the
required string and CRC as follows:

FMTST 100 “g1i[123456789]G8”

FMTST

 is the command to store a user defined formatter from the command line.

100

 is the string number you want to store it under; this can be 0-255.

 is the start of the format string.

g1

 is the formatter that instructs the SDM-SIO4 to use the CRC16 algorithm.    It

initialises the CRC16 to start calculation from here on any characters.

i[123456789]

 is the formatter that will transmit the string ‘123456789’ to

whichever port Instruction P113 requires. While this string is being processed by
the SDM-SIO4 the CRC16 will be calculated on it.

G8

 is the filter which tells the SDM-SIO4 that this is the position where it should

append the CRC16 to the string. Also the number 8 defines the CRC16 output
format which in this case is 16 bit ASCII hex.

 is the end of the string.

Содержание SDM-SIO4

Страница 1: ...SDM SIO4 4 Channel Serial I O Interface User Guide Issued 17 3 97 Copyright 1997 Campbell Scientific Ltd...

Страница 2: ......

Страница 3: ...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 bef...

Страница 4: ......

Страница 5: ...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...

Страница 6: ...nfiguration 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 Outputti...

Страница 7: ...ard 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 datalo...

Страница 8: ...er Command Line Control Datalogger Command Control CRC SIG Driver Format Driver User Strings CRC SIG Driver Filter Driver Converted Data Buffer 1 0 0 K K K Handshake Line Command Line Switch Status LE...

Страница 9: ...act Campbell Scientific for further details Serial Port Buffers Each serial port has a receive Rx buffer a transmit Tx buffer and a processed data storage buffer It is important to understand these bu...

Страница 10: ...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 w...

Страница 11: ...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...

Страница 12: ......

Страница 13: ...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 SI...

Страница 14: ...r 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...

Страница 15: ...ew 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 a...

Страница 16: ......

Страница 17: ...sing 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...

Страница 18: ...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 You must always set up a filter if you w...

Страница 19: ...er 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 l...

Страница 20: ...pbell 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 int...

Страница 21: ...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 m...

Страница 22: ...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 fi...

Страница 23: ...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 T...

Страница 24: ...al 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 explanati...

Страница 25: ...talogger is running a program which communicates with the SDM SIO4 However all datalogger activity related to port 1 is ignored Complicated or long string definitions are best set up by editing a text...

Страница 26: ...The above example stores the string definition This is a string crlf in string 22 This string will include the two quotation marks as shown fmtst string number format definition This command will stor...

Страница 27: ...strings filters and formatters are erased ports are set to 9600 baud 1 stop bit no parity and no handshake All transmit and receive buffers are flushed All error counts are zeroed ramtest The system R...

Страница 28: ...ming error count Overrun error count Line break error count DTR handshake line status 0 low 1 high RTS handshake line status 0 low 1 high CTS handshake line status 0 low 1 high DSR handshake line stat...

Страница 29: ...st 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 HIGH...

Страница 30: ......

Страница 31: ...ter 1 Reps This specifies the number of times you wish this command to repeat for each SDM SIO4 connected to the datalogger with sequential addresses This will normally be set to one 5 1 2 Parameter 2...

Страница 32: ...he command options listed below it is necessary to leave a small delay before calling another instance of the instruction which communicates with the SDM SIO4 This is required to allow the SDM SIO4 to...

Страница 33: ...econd value returned shows whether or not data is available from a specific port A non zero digit indicates that data is available whereas a zero signifies that no data is available Command 5 is expla...

Страница 34: ...5 2 6 Command 5 Status This command returns the SDM SIO4 general status lithium battery level errors and data available flags The data is supplied as two floating point values First value Number of wa...

Страница 35: ...buffers to see if they have data This command has no additional options after the command The SDM SIO4 returns one Campbell Scientific floating point number to indicate if it has data as below Port 4...

Страница 36: ...guring a remote SDM SIO4 as changes can be made by downloading programs using the 321 command which can change the SDM SIO4 setup The datalogger can send other commands to the SDM SIO4 while the comma...

Страница 37: ...ute command line command 5 0 6 0 7 15 Length of command line string no of datalogger input locations 8 1 9 1 10 0 delay large enough 10ms to allow SDM SIO4 instruction 321 to finish P22 1 1 2 0 3 1 4...

Страница 38: ...RS232 device If the specified string has not been allocated then string not allocated is transmitted Values per repetition 0 Minimum delay characters 0 26 ports in milliseconds 5 2 16 Command 1025 Tra...

Страница 39: ...s have been lost due to data being sent too quickly for the SDM SIO4 to process the data Fourth Value Returned NOT USED SET TO ZERO Line break errors x x x x Line break errors is a count from 0 99 Thi...

Страница 40: ...x x x x XON XOFF 0 Leave as set previously 1 XOFF data stop data transmission from SDM SIO4 2 XON data restart data transmission from SDM SIO4 RTS 0 Leave as set previously 1 Clear RTS to low 2 Set R...

Страница 41: ...arity 5 1 5 2 stop bits even parity 6 1 5 2 stop bits odd parity Data Length 0 Leave as set previously 1 5 data bits 2 6 data bits 3 7 data bits 4 8 data bits Baud Rate 0 Leave as set previously 1 300...

Страница 42: ...nation character if set 8 Transmit a user defined string 0 255 or fixed string 256 511 9 String filter type See Filter Strings in Section 2 3 String Number or Character Code If input mode 9 is chosen...

Страница 43: ...ter character as an ASCII code 0 255 999 means character not enabled Second Command Option Parameter 6 This is used for filter set up if data is expected back after output Input mode String number or...

Страница 44: ...line many users may prefer to set up the ports from their program This would normally be done once when the program is first compiled The instruction can be placed within a logical block which only r...

Страница 45: ...mmand 5 1999 1st Parameters 6 0 2nd Parameters 7 0 Values per Rep 8 0000 Loc _________ 9 1 0 Mult 10 0 0 Offset the set up filter command requires a delay of 4ms the nearest we can get is 10ms with P2...

Страница 46: ...one off set up of the receive filter with command 2054 is not appropriate For hardware controlled sensors use command 1027 to change the state of the handshaking lines 2 The datalogger waits for a per...

Страница 47: ...nd so 11 characters could take 12ms for the sensor command and another 20 characters 21ms for output data from the sensor The total time before the datalogger can get the data would therefore be 2 86...

Страница 48: ...ps 2 1 Loc number Table 2 Program 02 0 0000 Execution Interval seconds Table 3 Subroutines End Program 5 3 2 Sensors Which Send Data Out Without Prompting It can be very difficult to acquire data from...

Страница 49: ...be long enough for the sensor to transmit all of its data 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 AS...

Страница 50: ...inal storage 9 Sample P70 1 2 Reps 2 1 Loc Voltage Table 2 Program 02 0 0000 Execution Interval seconds Table 3 Subroutines End Program Example CR10X Program using the Polling Method This program will...

Страница 51: ...er 2 SDM SIO4 P113 1 1 Reps 2 0 Address 3 1 Send Receive Port 1 4 2054 Command 5 9200 1st Parameters 6 0 2nd Parameters 7 0 Values per Rep 8 0 Loc _________ 9 1 0 Mult 10 0 0 Offset delay required by...

Страница 52: ...e P70 1 2 Reps 2 3 Loc voltage1 end of IF 12 End P95 Table 2 Program 02 0 0000 Execution Interval seconds Table 3 Subroutines End Program Example CR10X Program using Interrupts Sensors with fast data...

Страница 53: ...first ASCII floating point number to convert f this filter searches for the second ASCII floating point number to convert Table 1 Program 01 2 Execution Interval seconds set control port 8 to i p so...

Страница 54: ...ers 7 2 Values per Rep 8 3 Loc voltage1 9 1 0 Mult 10 0 0 Offset set the output flag so that readings can be stored into final storage 3 Do P86 1 10 Set Output Flag High Flag 0 time stamp 4 Real Time...

Страница 55: ...nd word for storing the formatter sting in area 123 z261 This outputs the fixed string Temperature space This outputs an ASCII space f6 2 This takes the value from location 1 and outputs it The output...

Страница 56: ...ers used specifically flush the input buffer it is advisable to include instructions to flush the buffers within the configuration section of the program 5 6 Return Error Codes These return error code...

Страница 57: ...cksums CRCs or Signatures are then compared and if the two match exactly then the data received should be error free 6 2 Received Data No checksum will detect 100 of all errors The more sophisticated...

Страница 58: ...be set up to do one of the following 1 Poll the SDM SIO4 to see if data is available 2 Read the corrupt values as 99999 or 255 into locations and just store them as normal 3 Read the values check to s...

Страница 59: ...ord will be included in the CRC calculations f this filter gets the numeric value from the sensor and converts it into a format the datalogger can use Because filter x was used this converted value wi...

Страница 60: ...t 10 0 Offset a minimum delay of 4ms is required by the above P113 3 Excitation with Delay P22 1 1 Ex Channel 2 0 Delay W Ex units 0 01 sec 3 1 Delay After Ex units 0 01 sec 4 0 mV Excitation set flag...

Страница 61: ...ng the SDM SIO4 to see if any data is waiting If you decided not to poll the SDM SIO4 then you would get 99999 in the locations if data was not available to collect When the Checksum CRC or Signature...

Страница 62: ...wing The extra time in milliseconds you must wait before trying to get the data from the SDM SIO4 a one from b one from c d if applicable 6 3 Transmitted Data The SDM SIO4 can also do transmission sig...

Страница 63: ...fail 10 255 reserved for future use 6 3 1 Example of Using Transmitted Data Filters A sensor requires the string 123456789 but also requires a CRC16 appended to the end in 16 bit ASCII Hex which in th...

Страница 64: ...es per Rep 8 0000 Loc _________ 9 1 Mult 10 0 Offset Table 2 Program 02 0 0000 Execution Interval seconds Table 3 Subroutines End Program The program shown above will output to port 1 the string 12345...

Страница 65: ...01 sec 4 0 mV Excitation use formatter string 101 to transmit the string get data to port 1 3 SDM SIO4 P113 1 1 Reps 2 0 Address 3 1 Send Receive Port 1 4 2304 Command 5 9101 1st Parameters 6 0 2nd Pa...

Страница 66: ...sed The timings for the algorithms are shown below These timings are in addition to the normal formatter delay times a Time to set up an algorithm using formatter g is No of Ports 0 0656ms b The time...

Страница 67: ...ms The above timings are preliminary d With the CRC32 and CRC16 CCITT there is a extra 0 19ms for an additional calculation This is required as part of the CRC algorithm The total extra processing tim...

Страница 68: ......

Страница 69: ...I 105 i 10 CONTROL J 42 74 J 106 j 11 CONTROL K 43 75 K 107 k 12 CONTROL L 44 76 L 108 l 13 CONTROL M 45 77 M 109 m 14 CONTROL N 46 78 N 110 n 15 CONTROL O 47 79 O 111 o 16 CONTROL P 48 0 80 P 112 p...

Страница 70: ......

Страница 71: ...400 baud 11 4800 baud 12 9600 baud 13 19200 baud 14 38400 baud 15 76800 baud If the baud rate is higher than 9600 on two or more ports the SDM SIO4 may not be able to reliably collect data when there...

Страница 72: ...transmission stops if CTS falls 3 DTR and RTS are always set ignore CTS 4 XON XOFF software handshake The SDM SIO4 will XON again if no more XOFFs are sent after a time out of n x 50ms This mode is on...

Отзывы: