/* 温度巡检程序 */
/* 目标器件:AT89C51 */
/* 晶振:3MHZ */
/* 编译环境:Keil C51 */
/****包含头文件*************************
#include<reg51.h>
#include<absacc.h>
/******共阴数码管段码表***其中0X02代表“-”**************
unsigned char code Tab[]={0X3F,0X06,0X5B,0X4F,0X66,0X6D,0X7D,0X07,0X7F,0X6F,0X02};
/***************定义三个全局变量*************************
signed char tempL=-50; //温度下限值
signed char tempH=150; //温度上限值
signed char temperature=0; //测量温度值
sbit BUZZER=P1^0; //定义蜂鸣器的IO口为P1.0
sbit s2=p2^6;
sbit s3=p2^7;
sbit LED1=P2^3;
sbit LED2=P2^4;
sbit LED2=P2^5;
/*****按键消抖延时***********************
void delay()
{
unsigned int i;
for(i=0;i<300;i++)
}
/*****数码管LED显示延时******************
void LEDdelay()
{
unsigned int i;
for(i=0;i<60000;i++)
}
|