I am trying to learn usart with atmega328p.I know what is Baud Rate but I didn't understand what is BAUD_PRESCALE.I looked datasheet and internet but didnt get it.Do you have simple explanation about that ?
#define F_CPU 16000000UL
#define USART_BAUDRATE 9600
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1)
UBRR0L = BAUD_PRESCALE;
UBRR0H = (BAUD_PRESCALE>>8) ;
UCSR0B |= ( (TXEN0<<1) | (RXEN0 <<1) ) ;
UCSR0C |= ( (UMSEL00 << 1) | (UCSZ00 << 1) | (UCSZ01 <<1) );