9.2 Data Stream Decoder
No Data Input
Make sure that your data source is connected and transmitting data. An easy way to verify this is to plot the raw data stream or display the data in the Terminal. If there are no values in the plot or in the terminal, then data is likely not being received.
Decoder Mismatch
If you're getting a Variable Streamer mismatch error, make sure that the variables in the Variable Streamer match the incoming data exactly. The decoder expects a start of frame (SoF) byte, followed by a sequence of bytes that match the fields defined in the Variable Streamer, and an end of frame (EoF) byte which is a one's complement of SoF. The following situations would prevent a data packet from being decoded:
- Either the SoF or EoF bytes are not present
- Any of the fields are missing from a data packet transmission
- The size of the variable doesn't match that in the Variable Streamer
Each variable must have the number of bytes that match the data type. For
instance, Int8
would be one byte and Int16
would be 2
bytes.
Sometimes the mismatch error will clear itself even though there’s still a mismatch between the data frame sent by the target and the Variable Streamer in DV. This can happen when there is a small difference in byte lengths between the data frames. Check each field size to be sure they match.
[Start of Frame character][Data Field 1 * data type size in bytes][Data Field 2 * data type size in bytes]...[Data Field n * data type size in bytes][End of Frame character]
Example:
For two Int16
fields, x and y, the protocol byte sequence
would look like this:
[SoF][x1][x0][y1][y0][EoF]
A data stream that matches this protocol might look like this:
[0x3
][0x34
][0x12
][0x78
][0x56
][0xFC
]
The decoded x and y values would be 0x1234
,
0x5678
.