1 example of using transmitted data filters, 2 cr10x program example – Campbell Scientific SDM-SIO4 4-Channel Serial I/O Interface User Manual

Page 70

Advertising
background image

Section 6. Data Error Detection

6-8

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 initializes 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.

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 output from the SDM-SIO4 is every second:

*Table 1 Program

01: 1.0

Execution Interval (seconds)

;Transmit formatter string 100, which includes the calculated CRC16 to port 1

Advertising