Delay.c
上传用户:xhjmsc
上传日期:2019-09-13
资源大小:389k
文件大小:2k
源码类别:

传真(Fax)编程

开发平台:

C/C++

  1. /************************************************
  2. Delay subroutine
  3. Copyright 2006 by Vson. All rights reserved.
  4. Author:      Bryan Cai
  5. Date:        2006.12.21
  6. Description: soft delay
  7. Note:
  8. Identifier abbreviation: 
  9.                          c-const
  10.                          a-array
  11.                          p-pointer
  12.                          g-global
  13.                          uc-unsigned char
  14.                          w-unsigned int
  15.                          cnt-count
  16.                          pnt-point
  17. Update:
  18.       2006.12.21  Bryan      program header
  19. ************************************************/
  20. #include "includeH.h"
  21. void Delay1500ms(void)
  22. {     
  23.       unsigned char ucGeneralCount;
  24.       for (ucGeneralCount=0; ucGeneralCount<30; ucGeneralCount++)// delay 1.5S minimun 1 second
  25.       {
  26.          ATcmdDelay();  //50ms
  27.       }
  28. }
  29. void Delay2000ms(void)
  30. {     
  31.       unsigned char ucGeneralCount;
  32.       for (ucGeneralCount=0; ucGeneralCount<40; ucGeneralCount++)// delay 1.5S minimun 1 second
  33.       {
  34.          ATcmdDelay();  //50ms
  35.       }
  36. }
  37. void ATcmdDelay(void)//delay 50ms
  38.   unsigned int DelayCnt=0;
  39.   for(DelayCnt = 0;DelayCnt < 0xbfff;DelayCnt++)//0xbfff
  40.   _NOP();
  41. }
  42. void delay800ms(void)//delay 8000ms
  43.   unsigned int DelayCnt=0;
  44.   for(DelayCnt=0;DelayCnt<0xffff;DelayCnt++)
  45.   _NOP();
  46. void delay1us(unsigned int wDelayNum)//delay 1us
  47.   unsigned int wGeneralCount=0;
  48.   wDelayNum=wDelayNum-1;
  49.   for (wGeneralCount=0;wGeneralCount<wDelayNum;wGeneralCount++)
  50.   {
  51.      __no_operation();
  52.   }