Skip to Content
Block descriptionsStringSecured String Print Formatted

Secured String Print Formatted Block Description

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



Secured String Print Formatted block

Table of Contents

Inputs

Input NameTypeDescription
Input 1…NFormat-dependentConditional input
Values used to construct the output string. The total number of inputs and their respective types are dynamically evaluated based on the snprintf() formatting configurations. The quantity and types depend directly on the ASCII String parameter.

Outputs

Output NameTypeDescription
Datauint8[ ]A null-terminated ('\0') ASCII character string generated according to the ASCII String formatting constraints.

Block Parameters

ParameterDescription
Output Vector SizeThe maximum allowable length of the generated character string (including the trailing null terminator '\0'). This value defines the memory buffer size allocated to the internal snprintf() function routine.
ASCII StringThe formatting string expression following standard snprintf() syntax rules. Each individual format specifier maps sequentially to a dedicated block input port.

Specifier Syntax Structure (e.g., %10.2f):
10 – Minimum field width. Values shorter than this constraint are padded with spaces.
.2 – Fractional precision boundary specifying decimal places for floating-point numbers.
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[]).

Every specifier automatically creates one input port on the block. Standard alphanumeric characters or symbols (such as spaces, commas, or semicolons) present in the string are preserved and copied directly into the output text stream.
Sample TimeSpecifies the software cyclic execution update interval for the block in seconds.


Parameters for Secured String Print Formatted block

CubeMX Configuration for a Given MCU Model

CubeMX Settings

This block does not require any additional setup inside CubeMX.

Application Example

ASCII StringInput 1Input 2Input 3Input 4”Data” Output
%f %e %g %u12.34123.45.6123"12.340000 1.234000e+02 5.6 123"

See Also

Last updated on