现在我用的STM8S103,我想用printf函数,请问 除了要配置UART之外
还需要哪些步骤.谢谢
如果用官方的fwlib, 定义putchar 即可
char putchar (char c)
{
if (c == '\n')
{
/* put '\r' to hardware here */
/* Wait transmission is completed : otherwise the first data is not sent */
while (!(LINUART_SR & 0x40));
LINUART_DR = ('\r');
/* Wait transmission is completed */
while (!(LINUART_SR & 0x40));
}
/* put c to hardware here */
/* Wait transmission is completed : otherwise the first data is not sent */
while (!(LINUART_SR & 0x80));
LINUART_DR = (c);
/* Wait transmission is completed */
while (!(LINUART_SR & 0x80));
return (c);
}