1 example of using received data filters, 2 cr10x program example – Campbell Hausfeld Serial I/O Interface SDM-SIO4 User Manual

Page 59

Advertising
background image

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 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
initialises 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 on the
received data. If they match then the value converted with the “f” filter is made
available for the datalogger to get. If the checksums do not match then the value is
discarded as soon as any error is detected.

marks the end of the filter string.

The above example is just one way of using a filter to achieve the required result.

6.2.2 CR10X Program Example

A typical CR10X datalogger program to work with the above filter is shown
below.

Assume 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 sensor outputs
its string every second. Only the parameter values to be entered into the
appropriate instructions are shown.

Advertising