tom_2_2 发表于 2012-11-17 14:20:51

请教IARAVR printf使用

#include <stdio.h>
int putchar(int c)
{
while (!(UCSRA & 0x20));
return (UDR=c);
}


void main()
{
InitUart();
i=0;
SendByte(0x65);//这是自己写的,一定要有,至于输出什么无所谓。只要把这句注释掉,下面的printf就输出不了。请问这是咋回事?
while(1)
{
printf("%x ",i++);
}
}

tom_2_2 发表于 2012-11-17 14:24:19

InitUart()//初始化串口

void SendByte(unsigned char bdata)//查询式方式发送
{
SET_BIT(UCSRB,TXEN);
UDR=bdata;
while(!GET_BIT(UCSRA,UDRE));
}
这2个是自己以前写的
页: [1]
查看完整版本: 请教IARAVR printf使用