delay函数的用法参考资料.docVIP

  • 48
  • 0
  • 约1.06千字
  • 约 2页
  • 2019-08-19 发布于未知
  • 举报
BatchDoc Word文档批量处理工具 WinAVR?avr/delay函数的用法 在avr?GCC的函数库中包有个非常有用的精确延时函数, #include?util/delay.h 其中包括4个函数 _delay_loop_1(?);? _delay_loop_2(?); _delay_us(?); _delay_ms(?); ? _delay_loop_1(uint8_t?__count); 参数?__count?为8bit?长度,1-256,256表示为0。 每个循环花费3个CPU周期。 所以当晶振为1Mhz时,最长延时为768us(microseconds) ? _delay_loop_2(uint16_t?__count); 参数?__count?为?16bit?长度,1-65536,65536被认为是0。 每个循环花费4个CPU周期。 所以当晶振为1Mhz时,最长延时为262.1?ms?(milliseconds) 1*4*65536=262144?us ? _delay_us(double?__us); ? ?us的精确延时,参数为double,最长为768?us。 原头文件中定义了晶振频率为1Mhz。在makefile中默认为F_CPU=8000000 #ifndef?F_CPU /*?prevent?com

文档评论(0)

1亿VIP精品文档

相关文档