因仑“3+1”工程特种兵精英论坛

标题: 关于STM8L官方库里的串口Printf函数 [打印本页]

作者: 谭力源    时间: 2016-5-11 19:20
标题: 关于STM8L官方库里的串口Printf函数
本人在工作中使用到了STM8L的串口,串口printf借鉴了库里的代码
PUTCHAR_PROTOTYPE
{
  /* Write a character to the USART */
  USART_SendData8(USART1, c);
  /* Loop until the end of transmission */
  while (USART_GetFlagStatus(EVAL_COM1, USART_FLAG_TC) == RESET);

  return (c);
}

int main(void)
{
    uint8_t i = 100;
    USART_Config();
    while(1)
    {
        printf(" Time is %d ",i);
        delay_ms(100);
    }
    return 0;
}





欢迎光临 因仑“3+1”工程特种兵精英论坛 (http://bbs.enlern.com/) Powered by Discuz! X3.4