| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2360 人关注过本帖
标题:请帮忙检查一下到底在那个地方有错误.
只看楼主 加入收藏
kmtbm
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2012-7-17
结帖率:100%
收藏
 问题点数:0 回复次数:0 
请帮忙检查一下到底在那个地方有错误.
无法编译通过
我自己编程的程序无法编译通过,我反复查找,找不到原因,请帮忙检查一下到底在那个地方有错误,是什么原因?麻烦你告诉我出错误的地方,是什么原因发生这样的错误。
   下面是我编程的程序和错误提示(红色):

51 COMPILER V6.12 SWW                                                                   07/17/2012 15:23:29 PAGE 1   
C51 COMPILER V6.12, COMPILATION OF MODULE SWW
OBJECT MODULE PLACED IN H:\SWW.OBJ
COMPILER INVOKED BY: D:\keil\C51\BIN\C51.EXE H:\SWW.CDB SB OE
stmt level   source
   1          //班玛频率程序//
   2          #include<intrins.h>
   3          #include <reg52.h>
   4          #define  SEG  P2                           //7段数码管接P2
   5          #define  SCANP P1                            //数码管扫描线接P1
   6           sbit    PB0=P3^2;                                 //PBO安纽接P3.2
   7           char    TAB[3]={0xc0,0xf9,0xa4};
   8           char disp[4]={0xc0,0xc0,0xc0,0xc0};          //显示区数组初始显示0000;
   9          //=======声明T0定时函数=====
  10          #define  count_M1 5000                               //(T0(MODE1)的计数值0.05S
  11          #define  H_0 (65636-count_M1)/256                                     //(T0(MODE1)的计算高8位
  12          #define  L_0 (65636-count_M1)%256                                   //(T0(MODE1)的计算低8位
  13          char     times=0;                                      // 计算中断次数
  14          //=====声明基本变量=======
  15          bit     status_F=1;                                   //状态标志位
  16          char   scan=1;                                       // 扫描信号
  17          unsigned  int fred=0;                                  // 频率变量
  18          void    delay1m(int);                                // 声明延迟函数
  19          void  measure(void);                                  // 声明测量函数
  20          void  display(void);                                 // 声明显示函数
  21          sfr16 DPTR=0x82;                                      //声明DPTR
  22           //=========主程序============
  23            main()                                    //主程序开始
  24             {     while(1)                             //无穷循环,程序一直运行
  25   1          {if(PB0==0)                                //如果安下PB0
  26   2               {  status_F=0;                            //则进入测量阶段
  27   3                measure();                               //调测量函数
  28   3                 while(status_F=0);                       //等待0;测量完毕
*** WARNING C276 IN LINE 28 OF H:\SWW.C: constant incondition expression
  29   3               }
  30   2               else display();                            // 显示阶段
  31   2           }                                             //while 循环结束
  32   1         }                                              //主程序结束
  33          //=======  测量函数========
  34             void measure()                                //测量函数开始
  35               { SCANP=0xff;                               //关闭显示器
  36   1               IE=0X8a;                                   //启用T0,T1中断
  37   1               TMOD=0X51;                                 //T1为计算器,T0定时器
  38   1               TH0=H_0;                                   //设置T0高位
  39   1               TL0=L_0;                                   //设置T0低位
  40   1               TH1=0;                                     //TH1归0
  41   1               TL1=0;                                     //TL1归0
  42   1               TR0=1;                                     //启动TR0
  43   1               TR1=1;                                     //启动TR1
  44   1           {                                            //测量函数结束
  45   2      //==========T0_1S=============                     //T0_1S中断开始
  46   2         void To_1s()interrupt 1
*** ERROR C141 IN LINE 46 OF H:\SWW.C: syntax errornear 'interrupt'
  47   2           { TH0=H_0;                                     //设置T0计算器的高位
*** ERROR C136 IN LINE 47 OF H:\SWW.C: 'TH0': 'void'on variable
  48   2              TL0=L_0;                                     //设置T0计算器的低位
  49   2              if(++times==20)                             //如果达到1S
  50   2            {   times=0;                                  //重新计次
  51   3                 status_F=1;                                //完成测量
  52   3                 TR0=0;                                   //关闭TR0
  53   3                 TR1=0;                                   //关闭TR1
  54   3                 DPL=TL1;                                 //计算量的低8位
  55   3                 DPH=TH1;                                     //计算量的高8位
  56   3                  fred=DPTR;
  57   3                  if(fred>=10000)                        //超过10KZ
  58   3                 {  disp[3]=TAB[10];                      //负号填入千位数显示区
*** ERROR C213 IN LINE 58 OF H:\SWW.C: left side ofasn-op not an lvalue
  59   4                    disp[2]=TAB[10];                      //负号填入百位数显示区
*** ERROR C213 IN LINE 59 OF H:\SWW.C: left side ofasn-op not an lvalue
  60   4                   disp[1]=TAB[fred/10000];             //填入十位数显示区
*** ERROR C213 IN LINE 60 OF H:\SWW.C: left side ofasn-op not an lvalue
  61   4                    disp[0]=TAB[(fred/100)%10];  }         //填入个位数显示区                                 
            -   
*** ERROR C213 IN LINE 61 OF H:\SWW.C: left side ofasn-op not an lvalue
  62   3                else                                    //低于10KZ
  63   3                 {
  64   4                   disp[3]=TAB[(fred/1000)%10];               //填入千位数显示区
*** ERROR C213 IN LINE 64 OF H:\SWW.C: left side ofasn-op not an lvalue
  65   4                   disp[2]=TAB[(fred/100)%10];              //填入百位数显示区
*** ERROR C213 IN LINE 65 OF H:\SWW.C: left side ofasn-op not an lvalue
  66   4                   disp[1]=TAB[(fred/10)%10];             //填入十位数显示区
*** ERROR C213 IN LINE 66 OF H:\SWW.C: left side ofasn-op not an lvalue
  67   4                   disp[0]=TAB[fred%10];}              //填入个位数显示区
*** ERROR C213 IN LINE 67 OF H:\SWW.C: left side ofasn-op not an lvalue
  68   3              }                                           //结束if判断(达到1S)
  69   2          }                                              //T0_1S中断程序结束
  70   1     
  71   1         //===============显示程序=============
  72   1         void  display(void)                                //显示程序开始
*** ERROR C141 IN LINE 72 OF H:\SWW.C: syntax errornear 'void'
  73   1            {   char i;                               //声明变量
  74   1                 while(PB0==1)                          //如果按下PB0
  75   1                {  scan=0x01;                            //初始扫描信号
  76   2                   for(i=0;i<4;i++)                     //扫描4次
*** ERROR C202 IN LINE 76 OF H:\SWW.C: 'i': undefinedidentifier
  77   2                   {  SEG=0xff;                      //关闭7段LED数码管
  78   3                       SCANP=~scan;                     //输出扫描信号
  79   3                      SEG=disp;                    //输出显示信号
*** ERROR C202 IN LINE 79 OF H:\SWW.C: 'i': undefinedidentifier
  80   3                        delay1m(4);                       //延迟4hm
  81   3                       scan<<=1;                         //下一个扫描信号
  82   3                                }                     //for结束扫描4次
  83   2                          }                          //结束while按下PB0
  84   1                     }                               //显示函数结束
  85                //======延迟扫描===============
  86                   void delay1m(int x)                     //延迟函数开始
  87                  {      int i,j;                            //声明变量
  88   1                     for(i=0;i<x;i++)                    //数X次,约Xms
  89   1                         for(j=0;j<120;j++);          //数120次结束;约1ms
  90   1            }                                       //延迟函数结束
  91         
  92         
  93         
  94         
  95         
  96         
  97         
  98         
  99         
100         
101         
102         

C51 COMPILER V6.12 SWW                                                                   07/17/2012 15:23:29 PAGE 3   
103         
104         
105         
106         
107         
108         
109         
110         
111         
112         
C51 COMPILATION COMPLETE.  1 WARNING(S), 13 ERROR(S)
搜索更多相关主题的帖子: 原因 source 
2012-07-22 16:11
快速回复:请帮忙检查一下到底在那个地方有错误.
数据加载中...
 
   



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

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