#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit dula=P2^6;
sbit wela=P2^7;
sbit p0=P3^0;
sbit p1=P3^1;
sbit p2=P3^2;
sbit p3=P3^3;
sbit p4=P3^4;
sbit p5=P3^5;
sbit p6=P3^6;
sbit p7=P3^7;
uchar code tabledu[16]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
uchar code tablewe[6]={0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
void display_sm(uint num);
void delay(uint x);
uint keyscan(void);
uint qiujie(uint num2,uint num1,uint flag);
uint jisuan(uint key);
void main()
{
uint key;
P3=0x0f;
while(1)
{
key=keyscan();
display_sm(key);
}
}
void delay(uint x)
{
uint y,z;
for(y=x;y>0;y--)
{
for(z=110;z>0;z--)
{
;
}
}
}
void display_sm(uint num)
{
uchar shujv[6],i,wei=1;
shujv[5]=num/100000;
shujv[4]=num%100000/10000;
shujv[3]=num%10000/1000;
shujv[2]=num%1000/100;
shujv[1]=num%100/10;
shujv[0]=num%10;
for(i=1;i<6;i++)
{
if(shujv[i]!=0)