1.
//printf to redirect the C library function USART1
Int fputc (int ch, FILE * f)
{
While ((USART1 - & gt; The SR & amp; USART_FLAG_TXE)!=USART_FLAG_TXE);
USART1 - & gt; DR=ch;
Return (ch);
}
2. Project Options - & gt; C/C + + Complier - & gt; The Preprocessor - & gt; Defined symbols add:
_DLIB_FILE_DESCRIPTOR
(used to support the FILE type of a macro definition)
3. The project Options - & gt; General Options - & gt; Library Configuration - & gt; Library in FULL first, obtain complete C Library support
4. The header file contains:
# include & lt; Stdio. H>
Can be normal use printf
The output of the commonly used control characters mainly include the following:
Control characters description
% d according to the actual length of the decimal integer data output,
% ld output long integer data,
% m md for the specified output field width, if the data of digits is less than m, is left to fill in the blank space,
% u output unsigned integer (unsigned),
% c is used to output one character at a time,
% f is used to output of real Numbers, including single and double precision, in decimal form output,
%. The mf output real m a decimal, pay attention to in front of the m has a point,
% o output in the form of octal integer,
% s is used to output string,
% x output integers in hexadecimal form
CodePudding user response:
The building Lord, ask a, what is the meaning of IAR?CodePudding user response: