> Thanks for the quick response, I understand what the code > does, just not why a bit wise AND is performed and what > (1<<UDRE) "means". In my baby-C, I would probably have written (1<<UDRE) Means: The integer value 1, bit shifted left by the integer value of UDRE (5) as defined in the header file. This will give a binary value of 00010000 or 0x10 which is then ANDed with the UCSRA port to mask off the value of the UDRE bit, then loop while it is not set. > while (UCSRA.x != 0); > > where x is the UDRE bit. Any advantages to the way it's done below ? Well, I think some other compilers may do this sort of thing and there was some discussion a while ago about this approach with AVR-GCC but AFAICT the (1<<UDRE) approach is the current preferred way of doing this with AVR-GCC. Alex
Message
RE: [AVR-Chat] Re: Some C help please !
2007-03-13 by Alex Shepherd
Attachments
- No local attachments were found for this message.