As the title impplies, I've ATMEGA64a-au and 12mhz crystal, I set the baud rate to 9600 by these codes:
#define F_CPU 12000000UL
#define FOSC 12000000 // Clock Speed
#define BAUD 9600
#define MYUBRR FOSC/16/BAUD-1
..
void USART0_Init( unsigned int ubrr )
{
UBRR0H = (unsigned char) (ubrr >> 8);
UBRR0L = (unsigned char) ubrr;
UCSR0B = (1 << RXEN0) | (1 << TXEN0) | (1 << RXCIE0);
// Set frame format: 8data, 1stop bit
UCSR0C = (1 << USBS0) | (3 << UCSZ00);
}
void USART1_Init( unsigned int ubrr )
{
UBRR1H = (unsigned char) (ubrr >> 8);
UBRR1L = (unsigned char) ubrr;
UCSR1B = (1 << RXEN1) | (1 << TXEN1) | (1 << RXCIE1);
// Set frame format: 8data, 1stop bit
UCSR1C = (1 << USBS1) | (3 << UCSZ10);
}
..
USART0_Init(MYUBRR);
USART1_Init(MYUBRR);
It is fine when I work with that baud rate but I've recently come a cross a 115200bd device and I need too change it to that, but when I change this line :
#define BAUD 115200
The AVR Micro controller stops communicating, and I've no idea how to fix it. is it too fast for that device or I'm missing something?