Skip to Content
Block descriptionsStringParser String Scan Formatted

Parser String Scan Formatted Block Description

This block converts an ASCII character string into numerical or textual values according to a predefined format. Internally, it utilizes the C standard library function sscanf(). The number and data types of the outputs are automatically determined based on the specified format string.



String Scan Formatted block

Table of Contents

Inputs

Input NameTypeDescription
Stringuint8[]A null-terminated ('\0') ASCII character string stored in an array, containing the data payload to be parsed.

Outputs

Output NameTypeDescription
Statusuint8The number of successfully parsed fields. A value matching the total count of format specifiers indicates successful processing of the entire string sequence.
Output 1…NFormat-dependentConditional output
Data parsed and extracted from the input character string. The number of active output ports and their respective data types are dynamically evaluated based on the sscanf() formatting configurations. The quantity and types depend directly on the ASCII String parameter.

Block Parameters

ParameterDescription
ASCII StringParameter Description
The parsing format string expression following standard sscanf() syntax rules. Each individual format specifier automatically creates one output port on the block and dictates its target data type.

Specifier Syntax Structure (e.g., %10.2f):
10 – Maximum number of characters to be processed for this field.
.2 – Precision constraint matching standard sscanf() (for floating-point numbers, this typically does not affect parsing behavior).
f – Data type conversion flag.

Supported Specifiers:
%f – Decimal floating-point notation; e.g., 12.34, -5.6 (single).
%e – Scientific notation floating-point; e.g., 1.23e+03, -5.6e-02 (single).
%g – Compact decimal or scientific floating-point; e.g., 12.34 or 1.234e+04 (single).
%d – Signed decimal integer; e.g., -25, 1024 (int32).
%u – Unsigned decimal integer; e.g., 25, 1024 (uint32).
%ld – Long decimal integer; e.g., 123456 (int32).
%llu – Unsigned long long decimal integer; e.g., 1234567890123 (uint64).
%x, %X – Unsigned hexadecimal notation; e.g., 1A3F, FF, 0xFF (uint32).
%s – Character string terminated by a space or null byte; e.g., STM32 (uint8[]).

Spaces in the format layout map directly to delimiters parsing individual items out of the raw input stream. The total count of specifiers corresponds exactly to the number of active block output ports.
Sample timeSpecifies the software cyclic refresh execution update interval for the block.


Block parameters for String Scan Formatted

CubeMX Configuration for a Given MCU Model

CubeMX Settings

This block does not require any additional setup inside CubeMX.

Application Example

ASCII StringStringOutput 1Output 2Output 3Output 4
%f %e %g %u12.34 1.234e+02 5.6 12312.34123.45.6123

See Also

Last updated on