stm32中使用printf。
main.c
#include "stdio.h"
//使用的USART1
int fputc(int ch, FILE *f)
{
USART1->DR=(uint8_t)ch;
while((USART1->SR&0X40)==0);
return ch;
}
//实际中怎么用
while(){
printf("hello \n");
}
stm32中使用printf。
#include "stdio.h"
//使用的USART1
int fputc(int ch, FILE *f)
{
USART1->DR=(uint8_t)ch;
while((USART1->SR&0X40)==0);
return ch;
}
//实际中怎么用
while(){
printf("hello \n");
}