龙空技术网

STM32程序中如何用printf输出

电子制作DIY创客空间 1825

前言:

现在看官们对“fputc函数 printf”都比较讲究,朋友们都需要了解一些“fputc函数 printf”的相关文章。那么小编在网络上网罗了一些有关“fputc函数 printf””的相关知识,希望我们能喜欢,小伙伴们快快来了解一下吧!

在工程文件中重新写PUTCHAR_PROTOTYPE即可。本例程用的是HAL,标准库和这类似,只需添加标准库的发送函数。使用时和操作C语言的printf一样。

代码如下:

PUTCHAR_PROTOTYPE

{

/* Place your implementation of fputc here */

/* e.g. write a character to the EVAL_COM1 and Loop until the end of transmission */

HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF);

return ch;

}

标签: #fputc函数 printf