在串口能正常运行的前提下添加如下代码
头文件
#include "stdio.h"
声明
int fputc(int ch, FILE *f);
函数
int fputc(int ch, FILE *f)
{
USART_SendData(USART1, (uint8_t) ch);
while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET)
{}
return ch;
}
这样就应该可以使用printf输出字符串到电脑上了
还是不行的话查看一下
Target——Code Generation——选中Use MicroLIB
联系客服