1 example of using received data filters – Campbell Scientific SDM-SIO4 4-Channel Serial I/O Interface User Manual

Page 65

Advertising
background image

Section 6. Data Error Detection

6-3

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 for future use.

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 filter string to deal
with the sensor output you could type in the following command:

FLTST 100 “T[Frequency=]xg2n10fCCG8”

FLTST is the command to store a user defined filter 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 filter string.

T[Frequency=] is a filter which looks for an exact string match for
“Frequency=”. The next filter will only start if this string matches what is sent
from the sensor. “Frequency=” is not removed from the receive buffer.

x this filter marks the start of a data set; in other words the data will only be
available for the datalogger to collect when the complete string is received
correctly.

g2 this is the filter that tells the SDM-SIO4 to use the CRC16-CCITT
algorithm. It initializes the CRC16-CCITT algorithm to start calculation on any
characters from this point.

n10 This filter discards the 10 ASCII characters that make the word
“Frequency=”. Note: The word is discarded after filter g2. This is to ensure that
the discarded word 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 will
not be available for the datalogger to collect until the CRC16-CCITT signature
check is done. In this case the value converted is “12.34567”.

C this filter removes the char “H”.

C this filter removes the char “z”.

G8 this filter tells the SDM-SIO4 that the next ASCII hex is the start of the
checksum from the sensor. It also defines the data type to be ASCII hex 16 bit.
This filter will wait until enough characters have been received to make the hex
number up, in this case four bytes of ASCII hex. When the characters have
been received, the SDM-SIO4 will compare it with the check sum it calculated

Advertising