新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > STM8 用printf代替uart方法

STM8 用printf代替uart方法

作者: 时间:2016-11-11 来源:网络 收藏
在程序中添加:(头文件需要添加#include)

#ifdef__GNUC__
#definePUTCHAR_PROTOTYPEint__io_putchar(intch)
#else
#definePUTCHAR_PROTOTYPEintfputc(intch,FILE*f)
#endif
PUTCHAR_PROTOTYPE
{
//发送数据代码
returnch;
}

本文引用地址:https://www.eepw.com.cn/article/201611/316710.htm

出现identifier "FILE" is undefined,工程option中,如下选折:

需要在 IAR的Options -> General Options ->Library Configuration里设置一下函数库,不然printf函数不对,将Library Configuration 中的Library 设置由"Normal"改为"Full"就可以了。



关键词: STM8printfuart方

评论


技术专区

关闭