I am programming ATmega16 and I chose that controller in device manager(atmel studio 6.2) but the registers don't match with the registers in the datasheet for ATmega16. I am using ICE 3 and I tried with the simulator but it is the same result. Register UCSRC is different, from some other controller and can't write in it, even though I set MSB
to one
.
according to datasheet of ATMEGA16, it is not required to set MSB of UCSRC as its initial value is 1
.
When you are working with UART you need to make sure that,
You are setting proper UBRRL
and UBRRH
, according to controller clock using formula as below:
FOSC/16/BAUD-1
Enable RXEN
and TXEN
from UCSRB
UCSRC
according to your requirement of stop bit
and parity bit
Please refer following image :