標(biāo)題: 我的程序在編譯的時(shí)候總顯示Target not created 怎么回事啊求大神解答 [打印本頁(yè)]

作者: 六六六jp    時(shí)間: 2017-12-25 17:58
標(biāo)題: 我的程序在編譯的時(shí)候總顯示Target not created 怎么回事啊求大神解答

#include<reg51.h>
#define uint unsigned int
#define uchar unsigned char
unsigned char KeyValue;
uint count;
uchar a,b,c,d,symbol,amount,KEY;
uchar code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff};
void Delay(uint nms)
{
uint i,j;
for(i=nms;i>0;i--)
  for(j=110;j>0;j--)
  ;
}
void Display()
   {
     P0=table[a];
  a=0;
  Delay(5);
  a=1;
  P0=table[b];
  b=0;
  Delay(5);
  b=1;
  P0=table[c];
  c=0;
  Delay(5);
  c=1;
  P0=table[d];
  d=0;
  Delay(5);
  d=1;
}
void Key()
{
KEY=0x0f;
if(KEY!=0x0f)//讀取按鍵是否按下
{
  Delay(1);//延時(shí)10ms進(jìn)行消抖
  if(KEY!=0x0f)//再次檢測(cè)鍵盤(pán)是否按下
  {
   
   //測(cè)試列
   KEY=0X0F;//10000
   switch(KEY)
   {
    case(0X07): KeyValue=0;break;
    case(0X0b): KeyValue=1;break;
    case(0X0d): KeyValue=2;break;
    case(0X0e): KeyValue=3;break;
   }
   //測(cè)試行
   KEY=0XF0;
   switch(KEY)
   {
    case(0X70): KeyValue=KeyValue+12;break;
    case(0Xb0): KeyValue=KeyValue+8;break;
    case(0Xd0): KeyValue=KeyValue+4;break;
    case(0Xe0): KeyValue=KeyValue+0;break;
   }
   while (KEY!=0xf0);  //檢測(cè)按鍵松手檢測(cè)
  }
  
}
}
void main()
{
     KeyValue=13;
     a=b=c=d=10;
     while(1)
  {
  
  while(count==0)
  {   
     Display();
     Key();
      if(KeyValue<=9)
        {
       a=KeyValue;
    count++;
    KeyValue=13;
       }
  }
  while(count==1)
  {
      Display();
   Key();
   while(KeyValue!=13)
   {
     if(KeyValue>9)
      {
        if(KeyValue==10)
     {
          symbol=0;
       count++;
       KeyValue=13;
     }
     if(KeyValue==11)
     {
           symbol=1;
        count++;
        KeyValue=13;
     }
      
         }
   }
  }
  while(count==2)
    {
       Display();
          Key();
    while(KeyValue!=13)
    {
            if(KeyValue<=9)
              {
             b=KeyValue;
          count++;
          KeyValue=13;
              }
     }
    }
    while(count==3)
    {
        Display();
         if(symbol==0)
      {
           amount=a+b;
      
      }
      if(symbol==1)
       {
           amount=a-b;
       }  
       c=amount/10;
       d=amount%10;
  
    }  
  
  }
}


作者: 小七仔    時(shí)間: 2017-12-25 18:27
輸出的錯(cuò)誤信息是什么?
作者: cccc888    時(shí)間: 2017-12-25 18:56
uchar a,b,c,d,symbol,amount,KEY;




void Key()





作者: cccc888    時(shí)間: 2017-12-25 19:02
修改后編譯正常,雖然C語(yǔ)言是區(qū)分大小寫(xiě)的,但是l51連接器可能有問(wèn)題。

作者: 州中制作    時(shí)間: 2017-12-25 19:37
void main()
{
     KeyValue=13;
     a=b=c=d=10;
     while(1)
  {
作者: 孤狼131    時(shí)間: 2017-12-25 21:28
一般是語(yǔ)法錯(cuò)誤,比如少加分號(hào)什么的,如果是用keil寫(xiě)的程序,可以直接點(diǎn)擊顯示錯(cuò)誤的框里面那一行,系統(tǒng)會(huì)指出你的錯(cuò)誤
作者: luoluoluo136    時(shí)間: 2017-12-26 10:19
keilc51編譯器中,大小寫(xiě)都會(huì)認(rèn)為是大寫(xiě)。。。所以,不要僅依賴大小寫(xiě)來(lái)區(qū)分變量或者函數(shù)。
作者: luoluoluo136    時(shí)間: 2017-12-26 10:20
#include<reg51.h>
#define uint unsigned int
#define uchar unsigned char
unsigned char KeyValue;
uint count;
uchar a,b,c,d,symbol,amount,KEY;
uchar code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff};
void Delay(uint nms)
{
uint i,j;
for(i=nms;i>0;i--)
  for(j=110;j>0;j--)
  ;
}
void Display()
   {
     P0=table[a];
  a=0;
  Delay(5);
  a=1;
  P0=table[b];
  b=0;
  Delay(5);
  b=1;
  P0=table[c];
  c=0;
  Delay(5);
  c=1;
  P0=table[d];
  d=0;
  Delay(5);
  d=1;
}
void Key_Scan()
{
KEY=0x0f;
if(KEY!=0x0f)//讀取按鍵是否按下
{
  Delay(1);//延時(shí)10ms進(jìn)行消抖
  if(KEY!=0x0f)//再次檢測(cè)鍵盤(pán)是否按下
  {
   
   //測(cè)試列
   KEY=0X0F;//10000
   switch(KEY)
   {
    case(0X07): KeyValue=0;break;
    case(0X0b): KeyValue=1;break;
    case(0X0d): KeyValue=2;break;
    case(0X0e): KeyValue=3;break;
   }
   //測(cè)試行
   KEY=0XF0;
   switch(KEY)
   {
    case(0X70): KeyValue=KeyValue+12;break;
    case(0Xb0): KeyValue=KeyValue+8;break;
    case(0Xd0): KeyValue=KeyValue+4;break;
    case(0Xe0): KeyValue=KeyValue+0;break;
   }
   while (KEY!=0xf0);  //檢測(cè)按鍵松手檢測(cè)
  }
  
}
}
void main()
{
     KeyValue=13;
     a=b=c=d=10;
     while(1)
  {
  
  while(count==0)
  {   
     Display();
     Key_Scan();
      if(KeyValue<=9)
        {
       a=KeyValue;
    count++;
    KeyValue=13;
       }
  }
  while(count==1)
  {
      Display();
   Key_Scan();
   while(KeyValue!=13)
   {
     if(KeyValue>9)
      {
        if(KeyValue==10)
     {
          symbol=0;
       count++;
       KeyValue=13;
     }
     if(KeyValue==11)
     {
           symbol=1;
        count++;
        KeyValue=13;
     }
      
         }
   }
  }
  while(count==2)
    {
       Display();
          Key_Scan();
    while(KeyValue!=13)
    {
            if(KeyValue<=9)
              {
             b=KeyValue;
          count++;
          KeyValue=13;
              }
     }
    }
    while(count==3)
    {
        Display();
         if(symbol==0)
      {
           amount=a+b;
      
      }
      if(symbol==1)
       {
           amount=a-b;
       }  
       c=amount/10;
       d=amount%10;
  
    }  
  
  }
}

作者: luoluoluo136    時(shí)間: 2017-12-26 10:20
改后能正常編譯。




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1