| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 428 人关注过本帖
标题:这个代码错误的太多 麻烦帮我改正一下 谢谢
只看楼主 加入收藏
zhangwai
Rank: 1
等 级:新手上路
帖 子:23
专家分:2
注 册:2010-1-6
结帖率:28.57%
收藏
 问题点数:0 回复次数:0 
这个代码错误的太多 麻烦帮我改正一下 谢谢
#include<reg52.h>
#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
unsigned char code dis_7[10]={0x03,0x9F,0x25,0x0D,0x99,0x49,0x41,0x1F,0x01,0x09};
char i;
sfr p0=0x80;
sfr p1=0x90;
sbit red1=p1^0;
sbit green1=p1^1;
sbit yellow1=p1^2;
sbit red2=p1^3;
sbit green2=p1^4;
sbit yellow2=p1^5;

uchar temp,aa,num,num1;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
void delay(uint z);
void main()
{
 num=60;
 num1=30;
 aa=0;
 SCON=0x00;   //设置串行口的工作方式
 PCON=0x00;
 TMOD=0x01;
 TH0=(65536-50000)/256;
 TL0=(65536-50000)%256;
 EA=1;
 ET0=1;
 TR0=1;
 temp=0xfe;
 P1=temp;
 P0=table[0];
 P0=0xfe;
 while(1);
 
}



void timer0() interrupt 1
{
 TH0=(65536-50000)/256;
 TL0=(65536-50000)%256;
 aa++;
  if(aa==20)
    {
   aa=0;
   num--;
   num1--;
  
   if(num==0){num=60;num1=30;}
    if(num>35)
         {red1=0;green1=1;yellow1=1;
       red2=1;green2=0;yellow2=1;
      
      if(num1<10)
      {for(i=0;i<3;i++)
        {SBUF=dis_7[0];
                          while(!TI);
                              TI=0;}
        SBUF=dis_7[num1];
                          while(!TI);
                              TI=0;
      
                          
        }
       else
          {for(i=0;i<2;i++)
           {SBUF=dis_7[0];
                            while(!TI);
                               TI=0;}
          SBUF=dis_7[num1%10];
           while(!TI);
                              TI=0;
          SBUF=dis_7[num1/10];
            while(!TI);
                              TI=0;
            }
      }
             }
           
           else if(num<=35&&num>30)
            {red1=0;green1=1;yellow1=1;
       red2=1;green2=1;yellow2=0;
       for(i=0;i<3;i++)
        {SBUF=dis_7[0];
                          while(!TI);
                              TI=0;}
        SBUF=dis_7[num1];
                          while(!TI);
                              TI=0;}
          else if(num<=30&&num>5)
                  {red1=1;green1=0;yellow1=1;
       red2=0;green2=1;yellow2=1;
        if(num<10)
      {for(i=0;i<3;i++)
        {SBUF=dis_7[0];
                          while(!TI);
                              TI=0;}
        SBUF=dis_7[num];
                          while(!TI);
                              TI=0;
      
                          
        }
       else
          {for(i=0;i<2;i++)
           {SBUF=dis_7[0];
                            while(!TI);
                               TI=0;}
          SBUF=dis_7[num%10];
           while(!TI);
                              TI=0;
          SBUF=dis_7[num/10];
            while(!TI);
                              TI=0;
            }
      }
   else if(num<=5)
       {red1=1;green1=1;yellow1=0;
     red2=0;green2=1;yellow2=1;
       for(i=0;i<3;i++)
        {SBUF=dis_7[0];
                          while(!TI);
                              TI=0;}
        SBUF=dis_7[num];
                          while(!TI);
                              TI=0;}
     
  }

 1
搜索更多相关主题的帖子: 麻烦 代码 
2010-01-06 14:05
快速回复:这个代码错误的太多 麻烦帮我改正一下 谢谢
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025711 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved