⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jiaotong.lst

📁 四路交通灯设计
💻 LST
字号:
C51 COMPILER V8.12   JIAOTONG                                                              03/16/2009 21:39:21 PAGE 1   


C51 COMPILER V8.12, COMPILATION OF MODULE JIAOTONG
OBJECT MODULE PLACED IN jiaotong.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE jiaotong.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include<reg51.h>
   2          #define uchar unsigned char
   3          #define uint unsigned  int
   4          sbit green1=P1^0;
   5          sbit yellow1=P1^1;
   6          sbit red1=P1^2;
   7          sbit red2=P1^3;
   8          sbit yellow2=P1^4;
   9          sbit green2=P1^5;
  10          
  11          char miao_re,miao_ye,miao_gr,gr_miao,ye_miao,re_miao;
  12          uchar count,state,dx_state;
  13          
  14          uchar code duan[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
  15          
  16          void delay(uint z)
  17          {
  18   1              uint x, y;
  19   1              for(x=z;x<0;x--)
  20   1                      for(y=110;y<0;y--);
  21   1      }
  22          
  23          void display(uchar nb_shu)
  24          {        
  25   1               P3=0xfe;
  26   1               P2=duan[nb_shu/10];
  27   1               delay(2);
  28   1               P2=0;
  29   1      
  30   1               P3=0xfd;
  31   1               P2=duan[nb_shu%10];
  32   1               delay(2);
  33   1               P2=0;
  34   1      }
  35          void display_dx(uchar dx_shu)
  36          {
  37   1               P3=0xbf;//
  38   1               P2=duan[dx_shu/10];
  39   1               delay(2);
  40   1               P2=0;
  41   1      
  42   1               P3=0x7f;//
  43   1               P2=duan[dx_shu%10];
  44   1               delay(2);
  45   1               P2=0;
  46   1      }
  47          void main()
  48          {       
  49   1              TMOD=0x01;
  50   1              TH0=(65536-50000)/256;
  51   1              TL0=(65536-50000)%256;
  52   1              EA=1;
  53   1              ET0=1;
  54   1              TR0=1;
  55   1              miao_gr=18;
C51 COMPILER V8.12   JIAOTONG                                                              03/16/2009 21:39:21 PAGE 2   

  56   1              miao_ye=7;
  57   1              miao_re=36;
  58   1      
  59   1              gr_miao=38;
  60   1              ye_miao=4;
  61   1              re_miao=17;
  62   1              while(1)
  63   1              {
  64   2                      if(state==0)
  65   2                       {display(miao_gr);green1=0;red1=1;yellow1=1;}
  66   2                      if(dx_state==0)
  67   2                       {display_dx(re_miao);green2=1;red2=0;yellow2=1;}
  68   2      
  69   2                      if(state==1)
  70   2                       {display(miao_ye);yellow1=0;green1=1;red1=1;}
  71   2                      if(dx_state==1)
  72   2                       {display_dx(ye_miao);green2=1;red2=1;yellow2=0;}
  73   2      
  74   2                      if(state==2)
  75   2                       {display(miao_re);red1=0;yellow1=1;green1=1;}
  76   2                      if(dx_state==2)
  77   2                       {display_dx(gr_miao);green2=0;red2=1;yellow2=1;}
  78   2               }
  79   1      }
  80          
  81          void time0() interrupt 1
  82          {
  83   1              count++;
  84   1              if(count==20)
  85   1              {
  86   2                      count=0;
  87   2      
  88   2                      if(state==0)miao_gr--;//        这里的state为0一定要判断的;
  89   2                      if(dx_state==0)re_miao--; 
  90   2                      if(miao_gr==-1)
  91   2                              {miao_gr=18;state=1;}
  92   2                      if(re_miao==-1)
  93   2                               {re_miao=17;dx_state=1;}
  94   2      
  95   2                      if(state==1)miao_ye--;
  96   2                      if(dx_state==1)ye_miao--;
  97   2                      if(miao_ye==-1)
  98   2                         {miao_ye=7;state=2;} //这里是miao5减一之后才显示的;
  99   2                      if(ye_miao==-1)
 100   2                              {ye_miao=4;dx_state=2;}
 101   2      
 102   2                      if(state==2)miao_re--;
 103   2                      if(dx_state==2)gr_miao--;
 104   2                      if(miao_re==-1)
 105   2                          {miao_re=37;state=0;}
 106   2                      if(gr_miao==-1)
 107   2                              {gr_miao=39;dx_state=0;}
 108   2              }
 109   1              TH0=(65536-50000)/256;
 110   1              TL0=(65536-50000)%256;
 111   1      }
 112          
 113          
 114          


MODULE INFORMATION:   STATIC OVERLAYABLE
C51 COMPILER V8.12   JIAOTONG                                                              03/16/2009 21:39:21 PAGE 3   

   CODE SIZE        =    362    ----
   CONSTANT SIZE    =     10    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      9    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -