ATmega128a 串口0接收中断为什么进不去! 高手帮忙看一下用的是Atmel studio6.0 中断可以直接那么写,把下面的都改成串口1的话是可以的?
#include
#include
#include til/delay.h>
void Init_IO(void)
{
DDRA = 0xFF;
PORTA = 0xaa;
DDRF = 0xFF;
DDRC = 0xFF;
}
void UART0_Init(void)
{
UCSR0A = 0x00;
UCSR0B =0x98;//(1<
//UCSR0B = ( 1 << RXEN0) | ( 1 << TXEN0 );
UCSR0C = 0x06;//(1<
UBRR0H = 0x00;//(unsigned char)(MYUBRR>>8);
UBRR0L = 51;//(unsigned char)MYUBRR; //Set Baudrate, UBRR0L = 51, 9600bps
// UBRR0L = (SYSCLK/((uint32_t)BAUD_RATE * 8) - 1); //波特率设置
}
ISR(SIG_USART0_RECV)
{
PORTF = UDR0;
PORTC = ~PORTC;
}
int main(void)
{
Init_IO();
UART0_Init();
sei();
while(1)
{
; //TODO:: Please write your application code
}
}