部分程序
#include <reg51.h>
#include "intrins.h"
#define uint unsigned int //宏定义
#define uchar unsigned char //宏定义
uchar i=0,j=0,k=0, s=1,f=1,m=0,a[9]; //定义变量
sbit K4=P1^3; //位定义
sbit K5 =P1^4; //位定义
sbit fmq =P3^6; //位定义
sbit DQ=P3^3; //温度输入口
sbit DIN=P0^7;
uint h;
uint temp;
uint num;
uint numc;
//uchar code sz[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xbf} ; //数字编码表
//uchar code xw[]={ 0xff,0xfe,0xfd,0xfb,0xf7, //选位编码表
//0xef,0xdf,0xbf,0x7f
//};
//**************温度小数部分用查表法***********//
uchar code ditab[16]=
{0x00,0x01,0x01,0x02,0x03,0x03,0x04,0x04,0x05,0x06,0x06,0x07,0x08,0x08,0x09,0x09};
//
uchar code dis_7[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff,0xbf};
//共阳LED段码表 "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "不亮" "-"
uchar code scan_con[8]={0xf7,0xfb,0xfd,0xfe,0xef,0xdf,0xbf,0x7f}; //列扫描控制字
uchar data temp_data[2]={0x00,0x00}; //读出温度暂放
uchar data display[10]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; //显示单元数据,共4个数据和一个运算暂用
//uchar data display1[5]={};
//
//
//
void pf() //区分出个位和十位
{
a[1]=s/10;
a[2]=s%10;
a[3]=11;
a[4]=f/10;
a[5]=f%10;
a[6]=11;
a[7]=m/10;
a[8]=m%10;
}
/*****************11us延时函数*************************/
//
void delay(uint t)
{
for (;t>0;t--);
}
/*****************延时函数***********************/
void ys ( int d )
{
int b ,c ;
for (b = d;b>0;b--)
for (c=110;c>0;c--) ;
}
//****************1ms基准延时程序
void delay1ms(uint i)
{
uchar j;
while(i--)
{
for(j=0;j<115;j++)
|