#include <reg52.h>
#include <stdlib.h>
#define uint unsigned long
#define uchar unsigned char
sbit N1 = P1^0;
sbit N2 = P1^1;
sbit N3 = P1^2;
sbit N4 = P1^3;
uchar code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
uint num;
int a,t1=0;
void delayms(uint xms) //延时函数
{
uint i,j;
for(i=xms;i>0;i--)
for(j=10;j>0;j--);
}
void display(uint num)
{
N1=0;
P0=table[(num/1000)];
delayms(1);
P0=0XFF;
N1=1;
N2=0;
P0=table[(num%1000)/100];
delayms(1);
P0=0XFF;
N2=1;
N3=0;
P0=table[(num%100)/10];