向大侠求助啊 。lcd这个问题,我不知道错哪里了
时间:10-02
整理:3721RD
点击:
程序如下,编译时说:1602.c(51): warning C206: 'write_data': missing function-prototype
1602.c(51): error C267: 'write_data': requires ANSI-style prototype
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar code table[]="I LOVE YOU!";
uchar code table1[]="WWW.TXMCU.COM";
sbit lcden=P3^4;
sbit lcdrs=P3^5;
sbit duan=P2^6;
sbit wei=P2^7;
uchar num;
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void write_com(uchar com)
{
lcdrs=0;
P0=com;
delay(5);
lcden=1;
delay(5);
lcden=0;
}
void write_date(uchar date)
{
lcdrs=1;
P0=date;
delay(5);
lcden=1;
delay(5);
lcden=0;
}
void init()
{
duan=0;
wei=0;
lcden=0;
write_com(0x38);
write_com(0x0c);
write_com(0x06);
write_com(0x01);
}
void main()
{
init();
write_com(0x80);
for(num=0;num<16;num++)
{
write_data(table[num]);
delay(5);
}
write_com(0x80+0x40);
for(num=0;num<13;num++)
{
write_date(table1[num]);
delay(5);
}
while(1);
}
1602.c(51): error C267: 'write_data': requires ANSI-style prototype
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar code table[]="I LOVE YOU!";
uchar code table1[]="WWW.TXMCU.COM";
sbit lcden=P3^4;
sbit lcdrs=P3^5;
sbit duan=P2^6;
sbit wei=P2^7;
uchar num;
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void write_com(uchar com)
{
lcdrs=0;
P0=com;
delay(5);
lcden=1;
delay(5);
lcden=0;
}
void write_date(uchar date)
{
lcdrs=1;
P0=date;
delay(5);
lcden=1;
delay(5);
lcden=0;
}
void init()
{
duan=0;
wei=0;
lcden=0;
write_com(0x38);
write_com(0x0c);
write_com(0x06);
write_com(0x01);
}
void main()
{
init();
write_com(0x80);
for(num=0;num<16;num++)
{
write_data(table[num]);
delay(5);
}
write_com(0x80+0x40);
for(num=0;num<13;num++)
{
write_date(table1[num]);
delay(5);
}
while(1);
}
数组可以这样定义?不需要加大括号?
书上的程序,错误的地方的错误原因是什么啊
你压根就没发现你数组有问题?
我觉得数组里面应该存放着取模软件的所取到的数据。
你试下加个大括号吧。如 uchar code table[]={"I LOVE YOU!"};
uchar code table1[]={"WWW.TXMCU.COM"};
错误地方不在这,不行。你分析分析,提示错误的地方会是哪里产生的
你的定义void write_date(uchar date)你的调用write_data(table[num]);一个a一个e啊
就是,谢谢你啊