Datasheet

Table Of Contents
154
ATmega32A [DATASHEET]
Atmel-8155D-AVR-ATmega32A-Datasheet_02/2014
The following code example shows how to read the UCSRC Register contents.
Note: 1. See “About Code Examples” on page 6.
The assembly code example returns the UCSRC value in r16.
Reading the UBRRH contents is not an atomic operation and therefore it can be read as an ordinary register, as
long as the previous instruction did not access the register location.
Assembly Code Example
(1)
USART_ReadUCSRC:
; Read UCSRC
in r16,UBRRH
in r16,UCSRC
ret
C Code Example
(1)
unsigned char USART_ReadUCSRC( void )
{
unsigned char ucsrc;
/* Read UCSRC */
ucsrc = UBRRH;
ucsrc = UCSRC;
return ucsrc;
}