Data Analysis
Data Analysis extracts one or more bytes or bits from received data and shows them as values of a chosen type. For example, if one byte in a protocol holds a temperature, you can set a scale factor and unit and read the result directly. Results can also be saved to global variables for use elsewhere.
Works only in HEX receive mode
Data Analysis processes only data received in HEX mode. It does nothing when the receive mode is text.
Concepts
- Group: A set of match conditions and several items. When received data matches a group's condition, every item in the group is parsed.
- Item: One field taken from the data. It has a position, a length, a display type, and other settings.
A group is valid only when it has a Match Content value and at least one item. An invalid group is marked "(invalid)" in the execute view and is not parsed.
Manage groups
Select a group file in the editor's Select group drop-down. Refresh, New group, and Delete group work the same as in Quick Send. You can rename a group by editing its name in the drop-down.
On first use, the program creates a group named Default. Its match content is 11 22 33 44, its match mode is Prefix Match, and it has one sample item named "Default Item". The sample item has no position or length set, so change it in the editor before you rely on its result.
Edit groups and items
The editor has two parts. The tree on the left shows groups at the top level and items under each group. Select a node to edit it in the panel on the right.
Group settings
| Field | Description |
|---|---|
| Group name | The title shown in the execute view |
| Match content | The text compared with received data, written in the HEX display format, for example 11 22 33 44 (with spaces) |
| Match mode | Prefix, suffix, exact, contains, or regular expression. The same as in Auto Answer |
After you change these, click Save Group Info.
Item settings
| Field | Description |
|---|---|
| Item name | The name shown in the execute view |
| Start position | The byte and bit where extraction starts. Bytes and bits both count from 0 |
| Data length | The number of bytes plus the number of bits to extract |
| Display type | How the result is shown. See below |
| Byte order | Big-endian or little-endian. Only available when the data length is more than 8 bits |
| Signed | Treat the data as a signed number. Affects the Decimal display type only |
| Scale factor | When Enable is checked, the value is multiplied by this factor |
| Data offset | This amount is added to the value. Used for Float, Double, and Decimal |
| Decimal places | The number of decimal places to show |
| Unit | Shown after the result. Display only |
| Save to variable | When checked, the result is written to the selected variable. Choose No Variable to skip this |
After you change these, click Save Data Item.
Right-click a node in the tree to add, copy, cut, paste, insert, or delete groups and items. Deleting asks for confirmation. A cut node is removed from its original place only after you paste or insert it.
Position and byte order
Both the start position and the data length have a byte part and a bit part. The program calculates them as follows:
- Start bit = start byte × 8 + start bit
- Total length = length bytes × 8 + length bits
Bits count from the least significant bit of a byte, so bit 0 is the lowest bit.
Big-endian reads the bytes in the order they appear in the packet. Little-endian reverses that order.
Example: The received data is 11 22 33 44, the start byte is 1, the length is 2 bytes, and the bit values are 0. The extracted bytes are 22 33.
- Big-endian, display type Hexadecimal:
0x2233 - Little-endian, display type Hexadecimal:
0x3322
Display types
| Display type | Result |
|---|---|
| Text | Shows the extracted bytes as characters. The length must be a whole number of bytes |
| Float | Reads the bytes as a 32-bit IEEE 754 floating-point number. If the length is not 32 bits, the integer value is converted to a float |
| Double | Reads the bytes as a 64-bit IEEE 754 floating-point number. If the length is not 64 bits, the integer value is converted to a double |
| Hexadecimal | Unsigned integer, shown with a 0x prefix |
| Decimal | Integer. Supports sign, scale factor, and data offset |
| Octal | Unsigned integer, shown in octal |
| Binary | Unsigned integer, shown in binary with a 0b prefix and padded to the data length |
| Boolean | Shows true when the extracted value is not 0, otherwise false. The data length must be 1 bit |
Scale and offset are applied as follows:
- Float and Double: if Enable is checked, the value is multiplied by the scale factor. Then the offset is added. Decimal places always apply.
- Decimal: if scaling is enabled, the value is multiplied by the scale factor, the offset is added, and the result uses the decimal places. If scaling is not enabled, only the offset is added, and the result is shown as an integer.
- Hexadecimal, Octal, Binary, Text, and Boolean do not use scale or offset.
Data length limits
The editor checks the length when you save an item:
| Display type | Limit |
|---|---|
| Boolean | Must be 0 bytes and 1 bit |
| Float | 1 to 32 bits |
| Double | 1 to 64 bits |
| Text | At least 1 byte. The bit part must be 0 |
| Hexadecimal, Decimal, Octal, Binary | 1 to 64 bits |
The bit part of every item must be between 0 and 7.
Save to a variable
When you check Save to variable and choose a variable, each parsed result is written to that variable. Before writing, the program converts the result to the variable's type. A value outside the type's range is clamped to the range. A value that cannot be converted is written as 0.
The drop-down lists only variables compatible with the current display type. A scaled integer is treated as a double. Create variables first in Global Variables.
Run Data Analysis
The execute view contains these controls:
- Group drop-down: Switch to another group.
- Edit button (…): Open the editor.
- Refresh button (…): Reload the group list.
- Start Analysis / Stop Analysis: Turn parsing on or off. When it is on, incoming HEX data is parsed.
Results appear as collapsible groups. Each group has three columns: Name, Value, and Unit. Before any data is parsed, each value shows --.
Every data packet is compared with each group's match condition. When a group matches, its items are parsed and their values update right away. When several groups match, each one is parsed.
When parsing fails, the value cell shows an error message. Common messages are:
| Message | Cause |
|---|---|
| Error: Hex length must be even. | The packet has an odd number of hex characters |
| Error: Insufficient Data Length | The packet is shorter than the position the item requires |
| Error: Invalid position or length | The item's length is 0 |
| Error: unknown display type | The display type setting is invalid |
Notes
- Parsing uses only the HEX text of the packet, so the packet must contain enough bytes.
- While Data Analysis is running, you cannot switch groups or edit the configuration.
- While a device is running a group, editing of the group's items and deleting the group are locked in the editor.
