Electronics & Programming


Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » AVR-GCC
  • » [avr-gcc-list] How to (efficeiently !!!) testabitwithinamulti-byte intege [RSS Feed]

#1 Nov. 7, 2005 14:35:09

Dave H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] How to (efficeiently !!!) testabitwithinamulti-byte intege

From: Vincent Trouilliez <>> FWIW, I always had good luck with the delay functions in delay.h forshort> hardcoded (usec) delays.

Lucky you ! Other than wanting to avoid all this in-line stuff, the
reason I replaced _delay_us(40) in my lcd routine, by an empty for loop,
is that I accidentally realised that _delay_us(40) produced a 1,500us
delay somehow !!! Couldn't figure out why, I set the F_CPU #define
properly, and _delay_ms() works perfectly, but _delay_us clearly
doesn't. Might be a bug with the particular delay of 40us, don't know,
as don't use us delays anywhere else in my program.Well, as I said earlier, I wrote my own delay_us routine from _delay_loop_2rather than using the supplied _delay_us. I'm not sure why, it was so longago. Perhaps it didn't exist back then.My longest delay (i.e. parameter supplied to the macro) was 10 usec, but Inever measured to see how close it was. It couldn't have been over about100 usec, or the system would not have performed.. I did measure a coupleof 1 usec delays, and those were very close to exact.Regards,

AVR-GCC-list mailing list


  • Root
  • » AVR-GCC
  • » [avr-gcc-list] How to (efficeiently !!!) testabitwithinamulti-byte intege [RSS Feed]

Board footer

Moderator control

Enjoy the 22nd of April

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support