#include
#include
#define uchar unsigned char
#define uint unsigned int
***it ds=P2^2; //温度传感器信号线
***it dula=P2^6; //数码管段选线
***it wela=P2^7; //数码管位选线
***it beep=P2^3; //蜂鸣器
uint temp;
float f_temp;
uint warn_l1=270;
uint warn_l2=250;
uint warn_h1=300;
uint warn_h2=320;
***it led0=P1^0;
***it led1=P1^1;
***it led2=P1^2;
***it led3=P1^3;
unsigned char code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0xbf,0x86,
0xdb,0xcf,0xe6,0xed,
0xfd,0x87,0xff,0xef}; //不带小数点的编码
void display(uchar num,uchar dat)
{
uchar i;
dula=0;
P0=table[dat];
dula=1;
dula=0;
wela=0;
i=0XFF;
i=i&(~((0X01)<<(num)));
P0=i;
wela=1;
wela=0;
delay(1);
}
void dis_temp(uint t)
{
uchar i;
i=t/100;
display(0,i);
i=t%100/10;
display(1,i+10);
i=t%100%10;
display(2,i);
}
本人制作郭天祥C51单片机开发上的温控系统,在proteus上仿真不出结果,不知哪里连错了,望大神赐教!
|