#include <reg52.h>
#include <intrins.h>
#include "delay.h"
#include "main.h"




void num_display()
{
  P0 = 0xfe;
  P2 = num_var[ge];
  delay(1);
  P2 = 0XFF;

  P0 = 0xfd;
  P2 = num_var[ui];
  delay(1);
  P2 = 0XFF;

  P0 = 0xfb;
  P2 = num_var[bd];
  delay(1);
  P2 = 0XFF;

  P0 = 0xf7;
  P2 = num_var[qm];
  delay(1);
  P2 = 0XFF;

  P0 = 0xef;
  P2 = num_var[wj];
  delay(1);
  P2 = 0XFF;

  P0 = 0xdf;
  P2 = 0xff;
  delay(1);
  P2 = 0XFF;
}


void time() interrupt 1
{
	
	TH0 = 0X4C;
  TL0 = 0X0D;
  if(count == 20)
    {
      EA = 0;
      TR1 = 0;
      count = 0;
      return;
    }



//  enable = 1;
  count++;
}


int main()
{
//P1 µÆ
  setConfig();
  while(1)
    {
      if(EA == 0)
        {
          num = TH1 * 256 + TL1;

          wj = num / 10000;
          qm = (num % 10000) / 1000;
          bd = (num % 1000) / 100;
          ui = (num % 100) / 10;
          ge = num % 10;
					
					TL1=0X00;
					TH1=0X00;
					EA = 1;
					TR1 = 1;
        }
      num_display();
    }
}
