📄 delay.h
字号:
/*********************************************************************
*
* General Delay rouines
*
*********************************************************************
* FileName: Delay.h
* Dependencies: Compiler.h
* Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F
* Complier: Microchip C18 v3.02 or higher
* Microchip C30 v2.01 or higher
* Company: Microchip Technology, Inc.
*
* Software License Agreement
*
* This software is owned by Microchip Technology Inc. ("Microchip")
* and is supplied to you for use exclusively as described in the
* associated software agreement. This software is protected by
* software and other intellectual property laws. Any use in
* violation of the software license may subject the user to criminal
* sanctions as well as civil liability. Copyright 2006 Microchip
* Technology Inc. All rights reserved.
*
* This software is provided "AS IS." MICROCHIP DISCLAIMS ALL
* WARRANTIES, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, NOT LIMITED
* TO MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
* INFRINGEMENT. Microchip shall in no event be liable for special,
* incidental, or consequential damages.
*
*
* Author Date Comment
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Nilesh Rajbharti 5/9/02 Original (Rev 1.0)
* Nilesh Rajbharti 6/10/02 Fixed C18 ms and us routines
* Howard Schlunder 4/04/06 Changed for C30
********************************************************************/
#ifndef DELAY_H
#define DELAY_H
#include "..\Include\Compiler.h"
#if defined(__18CXX) && !defined(HI_TECH_C)
#include <delays.h>
#endif
#ifndef INSTR_FREQ
#error INSTR_FREQ must be defined.
#endif
#if defined(__C30__) || defined(HI_TECH_C)
#define Delay10us(x) \
{ \
unsigned long _dcnt; \
_dcnt=x*((unsigned long)(0.00001/(1.0/INSTR_FREQ)/6)); \
while(_dcnt--); \
}
void DelayMs(unsigned int ms);
#elif defined(__18CXX)
#define Delay10us(us) Delay10TCYx(((INSTR_FREQ/1000000)*us))
#define DelayMs(ms) Delay1KTCYx((((INSTR_FREQ/1000)*ms)/1000))
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -