标题:
protues仿真出现“no end statement found”,怎么办?
[打印本页]
作者:
小超、666
时间:
2018-5-10 11:34
标题:
protues仿真出现“no end statement found”,怎么办?
QQ截图20180510113209.png
(42.49 KB, 下载次数: 35)
下载附件
2018-5-10 11:33 上传
报错:no end statement found
源码如下:
TMOD=0x51;
TH0=0xD8;
TL0=0xF0;
ET0=1;
EA=1;
TR0=1;
}
void init_timer1()
{
TMOD=0x51;
TH1=0x00;
TL1=0x00;
ET1=1;
EA=1;
TR1=1;
}
void it_timer0() interrupt 1
{
uchar counter;
TF0=0;
TH0=0xD8;
TL0=0xF0;
counter++;
if(counter==100)
{
speed=(TH1*256+TL1+65536*cnt_ovtime)/100;
if(speed>=1200)
{
exc_speed=1;
nor_speed=0;
}
else
{
nor_speed=1;
exc_speed=0;
}
TH1=TL1=0x00;
counter=0;
cnt_ovtime=0;
}
}
void it_timer1()interrupt 3
{
TF1=0;
cnt_ovtime++;
}
void WriteDataLcd(uchar wdata)
{
LCD_DATA=wdata;
LCD_RS=1;
LCD_RW=0;
LCD_E=0;
dellay(100);
LCD_E=1;
}
void WriteCommandLcd(uchar wdata)
{
LCD_DATA=wdata;
LCD_RS=0;
LCD_RW=0;
LCD_E=0;
dellay(100);
LCD_E=1;
}
void lcd_init(void)
{
LCD_DATA=0;
WriteCommandLcd(0x38);
dellay(1000);
WriteCommandLcd(0x38);
WriteCommandLcd(0x08);
WriteCommandLcd(0x01);
WriteCommandLcd(0x06);
WriteCommandLcd(0x0c);
}
void display_xy(uchar x,uchar y)
{
if(y==1)
x+=0x40;
x+=0x80;
WriteCommandLcd(x);
}
void display_char(uchar x,uchar y,uchar dat)
{
display_xy(x,y);
WriteDataLcd(dat);
}
void display_string(uchar x,uchar y,uchar *s)
{
display_xy(x,y);
while(*s)
{
WriteDataLcd(*s);
s++;
}
}
void main()
{
lcd_init();
init_timer0();
init_timer1();
if(test)
{
P3 |=0x07;
display_string(0,0,"Life is precious!");
display_string(0,1,"Safe Driving!");
delay_ms(2000);
P3 &=~0x07;
lcd_init();
test=0;
normal=1;
delay_ms(2000);
}
if(normal)
{
while(1)
{
if(nor_speed)
{
P3 |=0x01;
P3 &=~0x06;
display_string(0,0,"Speed:");
dis[3]=speed/1000;
dis[4]=speed%1000;
dis[2]=dis[4]/100;
dis[4]=dis[4]%100;
dis[1]=dis[4]/10;
dis[0]=dis[4]%10;
if(dis[3]!=0)
{
display_char(6,0,dis[3]+0x30);
}
else
{
display_char(6,0,0xA0);
}
display_char(7,0,dis[2]+0x30);
display_char(8,0,dis[1]+0x30);
display_char(10,0,dis[0]+0x30);
display_string(9,0,".");
display_string(11,0,"km/h");
display_string(0,1,"Status:Normal");
}
if(exc_speed)
{
display_string(0,0,"Speed:");
dis[3]=speed/1000;
dis[4]=speed%1000;
dis[2]=dis[4]/100;
dis[4]=dis[4]%100;
dis[1]=dis[4]/10;
dis[0]=dis[4]%10;
if(dis[3]!=0)
{
display_char(6,0,dis[3]+0x30);
}
else
{
display_char(6,0,0xA0);
}
display_char(7,0,dis[2]+0x30);
display_char(8,0,dis[1]+0x30);
display_char(10,0,dis[0]+0x30);
display_string(9,0,".");
display_string(11,0,"km/h");
display_string(0,1,"Status:Speeding!");
P3 &=~0x01;
P3 |=0x06;
delay_ms(500);
display_string(0,1,"Warning!");
P3 &=~0x06;
delay_ms(500);
}
}
}
}
复制代码
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1