|
楼主 |
发表于 2013-8-9 17:15:38
|
显示全部楼层
程序开始,和数码管定义部分。
#include <reg51.h>
#include <intrins.h>
#include <./include/DS18B20.c>
#include <./include/General.c>
//void Int0_Routine(void);
extern unsigned char LEDSHU[12]= {0xc0,
0xf9,
0xa4,
0xb0,
0x99,
0x92,
0x82,
0xf8,
0x80,
0x90,
0xBF, //负号 10
0xDC, //超过范围符号 11
};
unsigned char sz[4]={0}; //缓存数组
unsigned int lengre=2; //制冷=0 制热=1 无=2
void xs(int x)
{
unsigned i=0x01;
unsigned j=0x08;
int z;
z=x;
if(z<0)
{
sz[0]=10;
}else
{
sz[0]=x/100%10;
}
//sz[0]=x/100%10;
sz[1]=z/10%10;
sz[2]=z%10;
for(i=0;i<3;i++) //对三位共阳数码管扫描
{
P3=P3^j;
P2=LEDSHU[sz[i]];
delay(1);
P3=P3^j;
j=j<<1;
}
} |
|