标题:
我的程序在编译的时候总显示Target not created 怎么回事啊求大神解答
[打印本页]
作者:
六六六jp
时间:
2017-12-25 17:58
标题:
我的程序在编译的时候总显示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);//延时10ms进行消抖
if(KEY!=0x0f)//再次检测键盘是否按下
{
//测试列
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;
}
//测试行
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); //检测按键松手检测
}
}
}
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;
}
}
}
作者:
小七仔
时间:
2017-12-25 18:27
输出的错误信息是什么?
作者:
cccc888
时间:
2017-12-25 18:56
uchar a,b,c,d,symbol,amount,
KEY
;
void
Key
()
作者:
cccc888
时间:
2017-12-25 19:02
修改后编译正常,虽然C语言是区分大小写的,但是l51连接器可能有问题。
作者:
州中制作
时间:
2017-12-25 19:37
void main()
{
KeyValue=13;
a=b=c=d=10;
while(1)
{
作者:
孤狼131
时间:
2017-12-25 21:28
一般是语法错误,比如少加分号什么的,如果是用keil写的程序,可以直接点击显示错误的框里面那一行,系统会指出你的错误
作者:
luoluoluo136
时间:
2017-12-26 10:19
keilc51编译器中,大小写都会认为是大写。。。所以,不要仅依赖大小写来区分变量或者函数。
作者:
luoluoluo136
时间:
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);//延时10ms进行消抖
if(KEY!=0x0f)//再次检测键盘是否按下
{
//测试列
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;
}
//测试行
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); //检测按键松手检测
}
}
}
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
时间:
2017-12-26 10:20
改后能正常编译。
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1