Embedded Freaks..

October 1, 2008

AVR UDRIE vs TXCIE Interrupt

Filed under: avr — Tags: — kunilkuda @ 4:06 pm

Newbies in AVR are always confused by these two interrupts (I’m not an exception here). What’s the difference between these two interrupts ? After googling for a while, I found avrfreaks forum discussion about the difference between the two (here).

To summarize the discussion:

Timing Diagram of UDRE vs TXC
Example for transmitting 2 bytes, loading on UDRE

Action    Flags         Comment
Startup   UDRE=1 TXC=0
Load UDR  UDRE=0 TXC=0  Software loads UDR
UDR->SR   UDRE=1 TXC=0  Hardware loads Shift Register
LOAD UDR  UDRE=0 TXC=0  Software loads UDR

after first byte finishes shifting
UDR->SR   UDRE=1 TXC=0  Hardware Loads Shift Register

after second byte finishes shifting
nothing   UDRE=1 TXC=1

Application
UDRE is normally used. TXC is normally not used, except for these situations:

  • Half duplex communication, such as RS485: where the application needs to know whether all of the bits has been transmitted or not, before releasing the bus.
  • Power saving mode: where the application needs to know whether the transmission has done, before switching to deeper power saving mode (where the UART peripheral is not available anymore).
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: