c51全局初始化及精确延时程序,51单片机精确延时程序
关键字:单片机延时程序
/*********************************************************************************************************
* initialization program
* qizhao,2007
* all rights reserved
* file : initial.h
* by : qizhao
* contact : zq1987731@163.com
*
* version : v2.1 γ
* 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 // at89s52
#include // absolute address access
#include // related to the string
#include // related to assembly language
#include // unicode conversion
#include // mathematics functions packet
#include // standard input or output
#include // memory management
#define true 1
#define false 0
#define bool bit // boolean variable
#define uchar unsigned char
#define uint unsigned int
#define ulong unsigned long
#define fosc 12000000ul // the frequency of crystal
#define nop _nop_();
/*********************************************************************************************************
*
* accurate delay(5us,10us)
*
*********************************************************************************************************/
void delay10us (void) // fosc->12000000
{
nop
nop
nop
nop
nop
nop
}
void delay5us (void) // fosc->12000000
{
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
影响电动汽车跑长途的两大因素是什么?
光电开关npn和pnp的区别
带显示屏指示的流水灯设计
浅谈监控指挥中心可视终端LED显示屏的应用
dfrobotHitec HS311标准舵机介绍
C51全局初始化及精确延时程序,51单片机精确延时程序
努比亚Z17miniS评测 1999元起的售价足以战胜同价位竞品
深开鸿KHDVK-3566B开发板正式合入OpenHarmony社区主干
美国在人工智能领域的领先地位都用了哪些招
中国芯片短缺的原因
电阻应变片的工作原理是什么
Facebook将无限期关停特朗普Facebook和Instagram账号
大健康行业被认为区块链技术最有潜力的应用领域
小米路由器AC2100评测 兼顾设计与性能
又一头部工业机器人厂商宣布涨价;上半年国内召回 255 万辆汽车!软硬件问题频出
三大运营商同步投入蜂巢式低功耗物联网市场
医疗机器人进军眼科领域 发挥比医生更稳定
Mastiff VR游戏《重火力:红影》上线Xbox版本
基于CSI的Wi-Fi传感技术将给智能家居带来全新体验
一种基于STM32的最小系统及串口通信的实现