Delay.c
上传用户:xhjmsc
上传日期:2019-09-13
资源大小:389k
文件大小:2k
- /************************************************
- Delay subroutine
- Copyright 2006 by Vson. All rights reserved.
- Author: Bryan Cai
- Date: 2006.12.21
- Description: soft delay
- Note:
- Identifier abbreviation:
- c-const
- a-array
- p-pointer
- g-global
- uc-unsigned char
- w-unsigned int
- cnt-count
- pnt-point
- Update:
- 2006.12.21 Bryan program header
- ************************************************/
- #include "includeH.h"
- void Delay1500ms(void)
- {
- unsigned char ucGeneralCount;
- for (ucGeneralCount=0; ucGeneralCount<30; ucGeneralCount++)// delay 1.5S minimun 1 second
- {
- ATcmdDelay(); //50ms
- }
- }
- void Delay2000ms(void)
- {
- unsigned char ucGeneralCount;
- for (ucGeneralCount=0; ucGeneralCount<40; ucGeneralCount++)// delay 1.5S minimun 1 second
- {
- ATcmdDelay(); //50ms
- }
- }
- void ATcmdDelay(void)//delay 50ms
- {
- unsigned int DelayCnt=0;
- for(DelayCnt = 0;DelayCnt < 0xbfff;DelayCnt++)//0xbfff
- _NOP();
- }
- void delay800ms(void)//delay 8000ms
- {
- unsigned int DelayCnt=0;
- for(DelayCnt=0;DelayCnt<0xffff;DelayCnt++)
- _NOP();
- }
- void delay1us(unsigned int wDelayNum)//delay 1us
- {
- unsigned int wGeneralCount=0;
- wDelayNum=wDelayNum-1;
- for (wGeneralCount=0;wGeneralCount<wDelayNum;wGeneralCount++)
- {
- __no_operation();
- }
- }