Registers used in serial com programming

  • Following are the registers used in programming of serial communication

USART DATA REGISTER (UDR)

 UDR

  • Used to hold byte of data that is being received or transmitted.

USART BAUD RATE REGISTER (UBRR)

 UBRR

  • Used to set baud rate

USART CONTROL STATUS REGISTER  A(UCSRA)

 ucsrA

  • RXC = 1 mean receive complete, 0 mean receive continue
  • TXC = 1 mean transmission complete, 0 mean transmission continue
  • UDRE = USART data register empty is 1 mean transmission complete,  0 mean transmission continue
  • FE = frame error if this bit is 1
  • DOR =data over run if this bit is 1
  • PE = parity error if this bit is 1
  • U2X = double baud rate if this bit is 1
  • MPCM = multi processor communication mode

USART CONTROL STATUS REGISTER   B(UCSRB)

 UCSRB

  • RXCIE = Receive complete interrupt enable bit is 1, to enable interrupt on RXC flag of UCSRA
  • TXCIE = Transmission complete interrupt enable bit is 1, to enable interrupt on TXC flag of UCSRA
  • UDRIE = USART data register empty interrupt enable bit is 1, to enable interrupt on UDRE flag of UCSRA
  • RXEN = Receive enable if this bit is 1
  • TXEN = transmission enable if this bit is 1
  • UCSZ2 = combine with UCSZ1 and UCSZ0 to decide fram bit size.
  • RXB8 & TXB8 is used in 9 bit frame (used earlier)

USART CONTROL STATUS REGISTER   C(UCSRC)

 UCSRC

  • URSEL = use to access UCSRC or UBRRH
  • UMSEL = USART mode select, 1 mean synchronous and 0 mean asynchronous

UPM1

UPM0

Parity mode

0

0

Disable

0

1

Reserved

1

0

Even

1

1

Odd

 

 

 

 

 

  • USBS = stop bit select 0 mean single stop bit and 1 mean double stop bit

 

UCSZ2

UCSZ1

UCSZ0

Bit size

0

0

0

5

0

0

1

6

0

1

0

7

0

1

1

8

1

1

1

9

 

 

 

 

 

  • UCPOL = clock polarity