Quote:
Originally Posted by MazdaMatt
quick googling turned up nothing... are the atmel users just not interested in interrupt driven communication? Every uart code snippet I saw had a while(blah blah){sit here with your thumb up your...}
....
|
Code:
FUNCTION Main
Enable Global Interrupts
LOOP FOREVER
{Do Stuff}
Transmit_Data(Data)
Sleep
END LOOP
END FUNCTION
FUNCTION Transmit_Data(Data)
Store Data into RingBuffer
Enable TX Buffer Empty Interrupt (instead of Dean's TX Complete Interrupt)
END FUNCTION
ISR TX_BUFFER_EMPTY_ISR
IF RingBuffer NOT EMPTY
UDR = RingBuffer.Next
ELSE
Disable TX Buffer Empty Interrupt
END IF
END ISR
More about that, including a link to a ringbuffer implementation fond in the same place as the (pseudo)code above:
View topic - [TUT] [SOFT] Using the USART - Interrupt driven serial comms :: AVR Freaks