Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Interrupt Service Routine for Atmega 16

2007-12-05 by David VanHorn

> A routine in the main loop checks the tx buffer for chars left by
> other tasks, and if there are any, enables the UDRE int which is how I
> send chars to the USART.

I wasn't quite clear here, this mainline routine turns on the UDRE int
if there is anything in the TX buffer when it runs.
The UDRE (tx) int turns itself off if it tries to get a char to send
and the "get" routine fails to get a char from the buffer (buffer
empty condition)   In my routines, a routine that fails for some
reason returns with the carry flag set, if it succeeds, then carry is
clear on return.
So when the UDRE int fetches a char, it either gets a byte in the TEMP
register and carry clear, and it puts the char in the USART TX and
RETIs, or it gets nonsense in TEMP, and carry set, which is it's clue
to turn itself off and RETI.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.