本人在工作中使用到了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;
}
|