?? initial.h
字號:
/*********************************************************************************************************
* Initialization Program
* QiZhao,2007
* All Rights Reserved
* File : initial.h
* By : QiZhao
* Contact : zq1987731@163.com
*
* Version : V2.2 γ
* Corrector : QiZhao
* Date : 2008.2.1 (Last modified)
*
* Remarks : Common set of macro definitions keyword, and by setting controlled
* crystal oscillator frequency precision delay subroutine.
*
*********************************************************************************************************/
#ifndef _initial_h_
#define _initial_h_
/*********************************************************************************************************
*
* Global macro definitions
*
*********************************************************************************************************/
#include <reg52.h> // AT89S52
#include <absacc.h> // Absolute address access
#include <string.h> // Related to the string
#include <intrins.h> // Related to Assembly Language
#include <ctype.h> // Unicode conversion
#include <math.h> // Mathematics functions packet
#include <stdio.h> // Standard input or output
#include <stdlib.h> // Memory Management
#define bool bit // Boolean variable
#define uchar unsigned char
#define uint unsigned int
#define ulong unsigned long
#define TRUE 1
#define FALSE 0
#define NOP _nop_();
#define FOSC 12000000UL // The frequency of crystal (Hz)
/*********************************************************************************************************
*
* Accurate delay(5us)
*
*********************************************************************************************************/
void delay5us (void) // FOSC--12000000Hz
{
NOP
}
/*********************************************************************************************************
*
* Accurate delay(1ms~255ms)
*
*********************************************************************************************************/
#define WAITE_HI (FOSC / 2 / 12 / 1000 >> 8 )
#define WAITE_LOW (FOSC / 2 / 12 / 1000 & 0xFF)
void delayms (uchar time)
{
do
{
uchar j;
#if WAITE_HI != 0
j = 0;
{
uchar i;
for (i = WAITE_HI; i > 0; i--)
{
while (--j);
}
}
#endif
#if WAITE_LOW != 0
j = WAITE_LOW;
while (--j);
#endif
}while (--time);
}
/*********************************************************************************************************
*
* Includes not repeat
*
*********************************************************************************************************/
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -