首先,要包含头文件"stdio.h"
第二:printf()函数使用了int fputc(int ch,FILE *f)完成其功能。
要使用printf,就需要重写这个函数。
第三,在工程选项的Target里边勾选USE MicroLIB项。
fputc示例如下:
int fputc(int ch,FILE *f)
{
     /* Place your implementation of fputc here */
  /* e.g. write a character to the USART */
  USART_SendData(USART1, (uint8_t) ch);
  /* Loop until the end of transmission */
  while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET)
  {}
  return ch;
}

printf

相关文章:

  • 2021-05-29
  • 2021-12-18
  • 2022-12-23
  • 2021-10-01
  • 2021-07-28
  • 2022-12-23
  • 2021-12-13
  • 2021-11-21
猜你喜欢
  • 2021-05-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-29
  • 2021-10-26
  • 2022-12-23
相关资源
相似解决方案