delay_loop.c

来自「CODE for embedded C ,hand coding version」· C语言 代码 · 共 30 行

C
30
字号
/*---------------------------------------------------------------*-
  Delay_Loop.C(v1.00)
  Author:06_Digital_Media 
  All Right Reserved
  ----------------------------------------------------------------
  Create a simple software delay using a loop
  -*--------------------------------------------------------------*/

  #include "Main.H"
  #include "Port.H"
  #include "Delay_Loop.H"

  /*---------------------------------------------------------------*-
   Delay_Loop_Wait()
   Delay duration varies with parameter
   Parameter is *ROUGHLY* ,the delay , in milliseconds
   on 12MHZ 8051(12 osc cycles)
   You need to adjust the timing for your application
   -*-------------------------------------------------------------*/

   void DELAY_LOOP_Wait(const tWord DELAY_MS){
     tWord x,y;
	 for(x=0;x<= DELAY_MS;x++)
	  for(y = 0;y<=120;y++);
   }

 /*------------------------------------------------------------*-
 ----------END OF FILE-------------------------------------------
 -*---------------------------------------------------------------*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?