Introducing a serial monitor application for monitor debugging, which is useful for identifying the data of calculation results inside a program, branch locations, etc.
It is based on sending a string (buffered) using an interrupt. The sample program sets up serial communication USART3 for serial monitoring and defines the send function USART3_Send_String().
The sample program uses the defined USART3 serial transmission to send numerical values and character strings in the program. Specifically, it converts two types of numerical values, data1 and data2, into character strings, String_data1 and String_data, and displays them alternately with the message strings stored in an array every 1000ms.
The usage of this application is simple, and the USART3 part and interrupt transmission related settings in this sample program can be diverted and utilized in the actual application.
Since tsprintf() is used for numeric-to-string conversion, tsprintf.c and its header file tsprintf.h should be copied to the same location as the source file.
Execution Example of tsprintf()： tsprintf(String, ,"%d",data);
The first argument of the function specifies the pointer (first address) to the array variable that will store the string, and the second argument specifies the type of number to display.
- Decimal display:%d
- Hexadecimal display(0-f):%x
- Hexadecimal display(0-F):%X
- ASCII string:%s
The third and final argument specifies the numerical data to be converted.