Keil无法编译

--- Error: can✀t execute ✀C:尀Keil尀C51尀BIN尀BL51.EXE✀sbit写完不能变蓝
2024-12-12 08:45:30
推荐回答(3个)
回答1:

帮你改了下! 自己在改改吧!

#include
#include
#define uint unsigned int
#define uchar unsigned char
#define BLKN 2 /*列存贮器数8*8行数*/
sbit E1 =P3^4; //E1为0开列(col)输出显示允许控制信号端口
sbit ST_CP =P3^2; //ST_CP 上升沿--移位寄存器的数据进入数据存储寄存器 输出锁存器的时钟信号端口
sbit MR =P3^3;//MR 为0将移位寄存器的数据清0
sbit key1 =P0^0;
sbit key2 =P0^1;
sbit soundring=P0^7;
uchar songndring=0;//add by mrli
uchar Soundring=0;//add by mrli

uchar t1;
uint key,spd;
void delay(unsigned int);
uchar data dispram[32];
uchar code table[]={ 0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8, 0x80,0x90,0x88,0x83,0xC6,0xA1,0x86,0x8E,0xFF};
uchar code donghua[][1]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F };//change by mrli

void delay(uint dt);

void main( )
{
uchar num,cur,tmp,nums=sizeof(donghua)/32;
SCON = 0x01;
TMOD = 0x01;
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
TR0 = 1;
TR1=1;
EA=1;
ET0=1;
ET1=1;
IT0=1;
P1= 0xc0;
key=1;
songndring=1;
P2=table[1];

while (1)
{
delay(2000);
spd=100-key*10;
for(tmp=0;tmp<1;tmp++)
{
for(num=0;num {
for(cur=0;cur<32;cur++) //显示
{
dispram[cur]=donghua[num][cur];
delay(spd);
}
}
}
}
}

void delay(uint dt)
{
uchar it,jt;
for(it=dt;it>0;it--)
for(jt=110;jt>0;jt--);
}

void leddisplay(void) interrupt 1 using 1
{
static uchar col=0;
TH0 = 0xf8;
TL0 = 0x30;
MR=0; //清理行输出,将移位寄存器的数据清0
MR=1;
SBUF = dispram[col*2]; //串行发送显示数据
while(TI==0); //等待发送完毕
T1 = 0;
SBUF = dispram[col*2+1]; //送显示数据
while(TI==0); //等待发送完毕
T1 = 0;
E1 = 1; //消隐
P1 = 0x00; //行号端口清0
P1 = 0x00; //行号端口清0
E1 = 0; //打开显示
ST_CP =1; //显示数据打入输出锁存器
ST_CP = 0; //锁存显示数据
P1 = col; //写入行号
col=(col+1)%16;

}

void keys() interrupt 3
{
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
t1++;
if(t1==10)
{
t1=0;
if(key1==0)
{
delay(2);
if(key1==0)
key--;
if(key<2)
key=1;
while(!key1);
delay(2);
while(!key1);
soundring=0;
delay(450);
};
if(key2==0)
{
delay(2);
if(key2==0)
key++;
if(key>8)
key=9;
while(!key2);
delay(2);
while(!key2);
soundring=0;
delay(450);
};
Soundring=1;
P2=table[key];

}
}

回答2:

project->new uvision project
选择你所使用的51芯片就是select device for target 'xxxx'
file->new 新建文件 保存为.c文件
双机source group 1 把刚才建的文件添加进去
flash----configure flash tools-----output选项卡勾上great hex files
然后仿真 ok

你要先建一个工程 然后按照上面的步骤才能生成二进制码

回答3:

首先把protues和keil联好机,
project->new uvision project选择你所使用的51芯片就是select device for target 'xxxx' file->new 新建文件 保存为.c文件
右击source group 1选add files to group'source group 1'
把刚才建的文件添加进去
还有相应的protues图要正确,
flash----configure flash tools-----output选项卡勾上great hex files
然后仿真 就ok了