🌀Johnny 猫街小巷浅余光
略懂.........
关注数: 0 粉丝数: 23 发帖数: 1,404 关注贴吧数: 5
帮忙分析啊,给为大哥大姐、、、、、、、、、 #include<REG51.H> #define uint unsigned int #define uchar unsigned char sbit NBred=P1^0; sbit NByellow=P1^1; sbit NBgreen=P1^2; sbit DXred=P1^4; sbit DXyellow=P1^5; sbit DXgreen=P1^6; uchar count=20,time=39; uchar i,count1; void main (void) {     TMOD=0x01;     TH0=0x3c;     TL0=0xb0;     TR0=1;     EA=1;     ET0=1;      while (1)      {          if(time>24)          P1=0xeb;        //P1--2=0,P1_4=0,南北绿东西红          else if(time>19)          {       //南北绿熄灭,南北黄闪烁              NBgreen=1;              NByellow=~NByellow;           }              //P1=0xed;              else if(time>4 )              P1=0xbe;    //P1--0=0,P1_6=0,南北红东西绿              else          {              DXgreen=1;              DXyellow=~DXyellow;     //东西绿熄灭,东西黄闪烁          }             } } void t0int ( ) interrupt 1 {      TH0=0x3c;      TL0=0xb0;      count--;      if(count==0)      {         count=20;         if(time==0)         time=39;         else         time--;            } } 黄灯咋不闪啊,帮我看一下,顺便改一下,咋让黄灯闪1s亮灭三次啊????????????
C语言题、谁帮我看看啊!!!! #include<reg52.h> #define uchar unsigned char #define uint unsigned int uchar code dey_tabledu[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x00}; uchar code dey_tablewe[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; uchar display_buffer[]={0,10,10,10,10,10,10,10};            void delayms(uint x) {      uchar t;      while(x--)for(t=0;t<120;t++); } void show_count_on_dsy() {      uchar i;      for(i=0;i<8;i++)      {          P2=dey_tablewe[i];          P0=dey_tabledu[display_buffer[i]];          delayms(2);      }                                     } void main() {      uchar i;      uchar key_no,key_counts=0;      P0=0xff;                       P1=0xff;                       P2=0x00;                    while(1)                       {                                      show_count_on_dsy();            P1=0xff;                        key_no=P1;                      switch(key_no)                                        {                                                           case 0xfe:key_counts++;                        if(key_counts>8)key_counts=8;                        display_buffer[key_counts-1]=key_counts;                          break;              case 0xfd:if(key_counts>0)display_buffer[--key_counts]=10;                         if(key_counts==0) display_buffer[0]=0;                         break;              case 0xfb:display_buffer[0]=0;                         for(i=1;i<8;i++)display_buffer[i]=10;                         key_counts=0;                  }                                                               while(P1!=0xff)show_count_on_dsy();      } } 这两天快疯啦!!!
1 下一页