打印
[汽车MCU – KEA]

KEIL下怎么使用printf函数-针对KEA系列

[复制链接]
1078|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
abchust|  楼主 | 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 ;
}

相关帖子

沙发
biyimifan| | 2017-3-27 08:46 | 只看该作者
重定向到串口

使用特权

评论回复
板凳
zchzch1014| | 2017-3-31 11:01 | 只看该作者
就像2楼说的一样,重定向到串口,然后通过串口发出去,232或者485

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

16

帖子

1

粉丝