Hi there,
THIS PROBLEM IS FRUSTATING ME LIKE HELL!
I am using an atmega8 with 8Mhz internal oscillator
I have used the following formula to set UBBRH & UBBRL registers
BAUD_PRESCALE=(((F_CPU / (USART_BAUDRATE * 16UL))) - 1)
where F_CPU is defined as 8000000
with USART_BAUDRATE =9600
but when I run the program the Uart run at a much faster speed !
I understood it when the receiver failed to understand the understand the transmission due to different baudrate and when I connected pin to speaker the A very high Pitch tone was produced
where as using the same settings on atmega16 it produced a LOW pitch tone
here's the code
Is this because I used the Uart PIN as GPIO pin as output for a short time before starting the Uart by setting the TXEN bit?
I have rechecked the code and algorithm numerous times but I don't find anything regarding that error!
please help
THIS PROBLEM IS FRUSTATING ME LIKE HELL!
I am using an atmega8 with 8Mhz internal oscillator
I have used the following formula to set UBBRH & UBBRL registers
BAUD_PRESCALE=(((F_CPU / (USART_BAUDRATE * 16UL))) - 1)
where F_CPU is defined as 8000000
with USART_BAUDRATE =9600
but when I run the program the Uart run at a much faster speed !
I understood it when the receiver failed to understand the understand the transmission due to different baudrate and when I connected pin to speaker the A very high Pitch tone was produced
where as using the same settings on atmega16 it produced a LOW pitch tone
here's the code
Rich (BB code):
UCSRB |= (1 << TXEN );
UCSRC |= (1 << UCSZ0 ) | (1 << UCSZ1 );
UBRRH = ( BAUD_PRESCALE >> 8);
UBRRL = BAUD_PRESCALE ;
I have rechecked the code and algorithm numerous times but I don't find anything regarding that error!
please help