C51 COMPILER V9.01   MIAOBIAO                                                              08/27/2014 12:29:24 PAGE 1   


C51 COMPILER V9.01, COMPILATION OF MODULE MIAOBIAO
OBJECT MODULE PLACED IN miaobiao.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE miaobiao.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include <reg51.h>
   2          #define uchar unsigned char
   3          uchar tab[10]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90}; //字型码表
   4          uchar number=0,counter=0,number_1=0,number_0=0;
   5          void display(void);  //显示函数声明
   6          void delay(void);   //延时函数声明
   7          main( )
   8          {
   9   1         TMOD=0x01;  //定时器0工作在方式1
  10   1         TL0=0xB0;    //定时器0赋初值
  11   1         TH0=0x3C;
  12   1         EA=1;       //打开总开关
  13   1         ET0=1;      //打开分开关
  14   1         TR0=1;      //启动定时器0
  15   1         while(1)
  16   1         {
  17   2           display( );  //调用显示子程序
  18   2         }
  19   1      }
  20          /*显示子程序*/
  21          void display(void)
  22          {  
  23   1        P2=tab[number_1]; //P2口送十位显示数字
  24   1        P3=0x01;        //十位显示
  25   1        delay( );
  26   1        P3=0x00;
  27   1        P2=tab[number_0]; //P2口送个位显示数字
  28   1        P3=0x02;        //个位显示
  29   1        delay();
  30   1        P3=0x00;
  31   1      }
  32          /*定时器0中断服务程序*/
  33          void timer0() interrupt 1 //定时器0中断号为1
  34          {
  35   1        ET0=0;
  36   1        TL0=0xB0;        //定时器0重新赋初值
  37   1        TH0=0x3C;
  38   1        counter++;
  39   1        if(counter==20)    //定时到1秒没有
  40   1        {
  41   2          counter=0;
  42   2          number++;
  43   2          if(number==60)  //计数值有没有到60
  44   2          {
  45   3           number=0;
  46   3          }
  47   2          number_1=number/10; // number_1放秒计数器的十位
  48   2          number_0=number%10; // number_0放秒计数器的个位
  49   2        }
  50   1        ET0=1;
  51   1      }
  52          void delay(void)   // 延时子程序
  53          {
  54   1        uchar data i;
  55   1        for(i=500;i>0;i--);
C51 COMPILER V9.01   MIAOBIAO                                                              08/27/2014 12:29:24 PAGE 2   

  56   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    120    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     14    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
