[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Serial Communication
From: |
Dave Hansen |
Subject: |
Re: [avr-gcc-list] Serial Communication |
Date: |
Thu, 29 Jan 2004 10:22:04 -0500 |
From: ks_347 <address@hidden>
[...]
In this serial communication righnow I am just sending the data to PC and
not receiving anything from PC, regarding the interrupt handling routine,
should I write routine for UDRE(data register empty) or TXC(tranmission
complete) interrupt?
As always, the answer is "it depends."
But for simple RS-232 communications to the PC, I would suggest DRE rather
than TXC. It is ever so slightly more efficient, and coding is simpler:
void transmit_routine( char *bfr, size_t len){
queue_up_characters(bfr, len);
enable_DRE_interrupt();
}
SIGNAL(DRE)
{
if (queue_is_empty(){
disable_DRE_interrupt();
}else{
UDR = get_next_character_from_queue();
}
}
Done. Regards,
-=Dave
_________________________________________________________________
Rethink your business approach for the new year with the helpful tips here.
http://special.msn.com/bcentral/prep04.armx