求解~哪里语法错误了~
时间:10-02
整理:3721RD
点击:
#include<reg52.h>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit e=P1^2;
sbit rs=P1^4;
sbit rw=P1^3;
sbit psb=P1^5;
void xianshi(void);
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void write_com(uchar com)
{
rw=0;
rs=0;
delay(2) ;
P2=com;
e=1;
delay(10);
e=0;;;
delay(3) ;
}
void write_data(uchar date)
rw=0;
rs=1;
delay(2) ;
P2=date;
e=1;
delay(10);
e=0;;;
delay(3) ;
}
void init()
{
delay(3);
write_com(0x30);
delay(5);
write_com(0x30);
delay(5);
write_com(0x0f);
delay(4);
write_com(0x01);
delay(240);
write_com(0x06);
delay(10);
}
void main()
{
init();
while(1);
{
xianshi();
while(1);
}
}
void xianshi(void)
{
uchar i;
uchar a;
a=0x10;
write_com(0x80);
delay(2);
for (i=0;i<16;i++)
{
write_com(a);
delay(2);
a++;
}
}
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit e=P1^2;
sbit rs=P1^4;
sbit rw=P1^3;
sbit psb=P1^5;
void xianshi(void);
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void write_com(uchar com)
{
rw=0;
rs=0;
delay(2) ;
P2=com;
e=1;
delay(10);
e=0;;;
delay(3) ;
}
void write_data(uchar date)
rw=0;
rs=1;
delay(2) ;
P2=date;
e=1;
delay(10);
e=0;;;
delay(3) ;
}
void init()
{
delay(3);
write_com(0x30);
delay(5);
write_com(0x30);
delay(5);
write_com(0x0f);
delay(4);
write_com(0x01);
delay(240);
write_com(0x06);
delay(10);
}
void main()
{
init();
while(1);
{
xianshi();
while(1);
}
}
void xianshi(void)
{
uchar i;
uchar a;
a=0x10;
write_com(0x80);
delay(2);
for (i=0;i<16;i++)
{
write_com(a);
delay(2);
a++;
}
}
把你出错的图贴出来……
e=0;;;
多了两个汉语的分号。
还有错误呀~高手~
怎么会有两个while(1)那程序不是卡在里面啊,请赐教
高手啊~
不要重复发贴,这个问题我已在另一个贴子回了你了