查看: 841|回复: 0
打印 上一主题 下一主题

关于STM8L官方库里的串口Printf函数

[复制链接]
跳转到指定楼层
沙发
发表于 2016-5-11 19:20:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本人在工作中使用到了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;
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 加入因仑

本版积分规则

快速回复 返回顶部 返回列表