Configuration Parameter |
Selectable Option/Value |
Description |
Format |
|
Enter the format of the output string. |
Buffer size |
|
Enter the size of the output buffer. |
Enable output status |
Check--Uncheck |
Return the number of success parameters. |
Enable pointer |
Check--Uncheck |
This will allow user to access pointer settings |
Select pointer |
|
List for pointer names will be listed in the drop-down. Select one to store data to it. |
Output string pointer |
Check--Uncheck |
If it is checked, this block will output the memory address of the pointer. |
Sample time (sec) |
-1 (inherited or specify |
Specify the sample time. |
INPUT/ OUTPUT Port
Port Name |
Port Type |
Date Type |
Description |
Output |
Vector Scalar |
uint8 uint32 |
Formatted string as a character vector Output the memory address of the pointer |
Configuration Parameter |
Selectable Option/Value |
Description |
Format |
|
Enter the format of the output string. |
Buffer size |
|
Enter the size of the output buffer. |
Enable output status |
Check--Uncheck |
Return the number of success parameters. |
Sample time (sec) |
-1 (inherited or specify |
Specify the sample time. |
INPUT/ OUTPUT Port
Port Name |
Port Type |
Date Type |
Description |
Input |
Vector |
uint8 |
Input string as a character vector |
Configuration Parameter |
Selectable Option/Value |
Description |
Sample time (sec) |
-1 (inherited or specify |
Specify the sample time. |
INPUT/ OUTPUT Port
Port Name |
Port Type |
Date Type |
Description |
Input |
Vector |
uint8 |
Input string as a character vector |
Length |
Scalar |
uint32 |
Character length of the input string. |
Configuration Parameter |
Selectable Option/Value |
Description |
Buffer size |
|
Enter the size of the buffer. |
Sample time (sec) |
-1 (inherited or specify |
Specify the sample time. |
INPUT/ OUTPUT Port
Port Name |
Port Type |
Date Type |
Description |
s1 |
Vector |
uint8 |
Input string as a character vector |
s2 |
Vector |
uint8 |
Input string as a character vector |
result |
Scalar |
int32 |
|
Configuration Parameter |
Selectable Option/Value |
Description |
Buffer size |
|
Enter the size of the buffer. |
Sample time (sec) |
-1 (inherited or specify |
Specify the sample time. |
INPUT/ OUTPUT Port
Port Name |
Port Type |
Date Type |
Description |
s1 |
Vector |
uint8 |
Input string as a character vector |
s2 |
Vector |
uint8 |
Input string as a character vector |
Num |
Scalar |
uint32 |
the maximum number of characters to be compared |
result |
Scalar |
int32 |
|
Configuration Parameter |
Selectable Option/Value |
Description |
Begin delimiter |
|
Enter the starting point. |
End delimiter |
|
Enter the end point. |
Buffer size |
|
Enter the size of the buffer. |
Sample time (sec) |
-1 (inherited or specify |
Specify the sample time. |
INPUT/ OUTPUT Port
Port Name |
Port Type |
Date Type |
Description |
Input |
Vector |
uint8 |
Input string as a character vector |
Output |
Vector |
uint8 |
Output string as a character vector |
This block is used to do string processing available in C programming.
The following functions are available in this block,
•sprintf
Sends formatted output to a string pointed to. It will take the inputs and put it in a single string in the format user has specified.
•sscanf
Reads formatted input from a string.
•strlen
Calculate the length of the string.
•strcmp
Compares the two strings provided. This function return values that are as follows,
1.if Return value < 0 then it indicates str1 is less than str2.
2.if Return value > 0 then it indicates str2 is less than str1.
3.if Return value = 0 then it indicates str1 is equal to str2.
•strncmp
Parameters,
1.S1 = This is the first string to be compared.
2.S2 = This is the second string to be compared.
3.Num = the maximum number of characters to be compared.
This function return values that are as follows,
4.if Return value < 0 then it indicates str1 is less than str2.
5.if Return value > 0 then it indicates str2 is less than str1.
6.if Return value = 0 then it indicates str1 is equal to str2.
•strextract
This function extracts the string between begin delimiter and end delimiter.
Demo file : esp32_string_processing_demo.slx
This example shows how to use the String Processing Block on ESP32. In this example, sprintf and sscanf functions are used.
A serial monitor software application is required to get the expected results. For this example, PuTTY open-source SSH and telnet client is used to monitor the serial output.
After the model file is compiled and uploaded to the ESP32 board, open the PuTTY software and connect to the relevant serial port with a baud rate of 115200. The following output should be visible on the serial monitor software.