[汽车MCU – KEA] KEIL下怎么使用printf函数-针对KEA系列

[复制链接]
 楼主| 发表于 2016-12-6 16:33 | 显示全部楼层 |阅读模式
请教!
main中有stdio.h
勾选了micro LIB
如下代码是借用STM32的,怎么改使用于KEA?
struct __FILE
{
int handle;
/* Whatever you require here. If the only file you are using is */
/* standard output using printf() for debugging, no file handling */
/* is required. */
};
/* FILE is typedef’ d in stdio.h. */
FILE __stdout;
FILE __stdin;
_sys_exit(int x)
{
   x = x;
}

void send_char(char num)
{
  rUTXH0 =num;
  while((rUTRSTAT0 & 4 )==0);
}
int fputc(int ch,FILE *f)
{
   send_char((char)ch);
   return ch;
}
int fgetc(FILE *f)
{
   while((rUTRSTAT0 &1)==0);
   return rURXH0 ;
}
发表于 2017-3-31 11:01 | 显示全部楼层
就像2楼说的一样,重定向到串口,然后通过串口发出去,232或者485
发表于 2017-3-27 08:46 | 显示全部楼层
重定向到串口
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

16

帖子

1

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