Mike, What makes the former syntax nicer is that it has no "magic numbers" embedded in the code. UCSRA.5 does not mean as much as UCSRA.UDRE (if that is defined) or as UCSRA & (1<<UDRE) - The latter does not require a library of structures defining the bits, just a bunch of #defines. You'll pick it up as you go along. :) DLC Mike Bronosky wrote: > All this is fine. But for many of us hobbyists that know just enough about > C, especially when it comes to AVRs, to be down-right-dangerous... > > For me something like the following, is good, proper and works. It is not > fully understood until I dissect. > while ((UCSRA & (1<<UDRE))==0); > > while(UCSRA.5 == 0); //while(USART Data Register Empty) > Haven't tried this but I think it should work and means "while the data > register is empty sit right here". > Now to the Xsperts may disagree. I'm a hobbiest, it works for me and best of > all I understand why it works. > > Mike > > On 3/14/07, David Appleton <englsprogeny@yahoo.com> wrote: > >> I am going to learn so much from this group...... >>Glad I joined. >> >> >>: ) >> >>[Non-text portions of this message have been removed] >> >> >> > > > > [Non-text portions of this message have been removed] > > > > > Yahoo! Groups Links > > > -- --------------------------------------- Dennis Clark TTT Enterprises ---------------------------------------
Message
Re: [AVR-Chat] Re: Some C help please !
2007-03-22 by Dennis Clark
Attachments
- No local attachments were found for this message.