#define F_CPU 4000000 //晶振频率
#define BAUD 9600 //波特率
void uart_init(void)
{
UBRRH=(F_CPU/BAUD/16-1)/256; //设置波特率
UBRRL=(F_CPU/BAUD/16-1)%6;
UCSRB=0x98; //使能RX,TX,RX中断
SREG|=0x80; //使能全局中断
}
void uart_sent(unsigned char dat) //发送字节
{
while(!(UCSRA&(1<<UDRE)));
UDR=dat;
}
#define BAUD
void uart_init(void)
{
}
void uart_sent(unsigned char dat)
{
}