问题已解决,我自己来回复一下。其实在这两个文件之外,我还写了一个main函数,main函数是这样写的。
#include <AT89X52.H>
#include "lcd_display.h"
//#include "SoundPlay.h"
#define uchar unsigned char
uchar code yin[2][16]={{0x40,0x80,0xFC,0x00,0x10,0x20,0xFF,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08},
{0x00,0x00,0x1F,0x00,0x04,0x02,0x7F,0x00,0x0F,0x08,0x08,0x0F,0x08,0x08,0x0F,0x08}};/*"音",0*/
uchar code yue[2][16]={{0x00,0x00,0xF8,0x08,0x88,0x84,0x84,0xFC,0x80,0x90,0x90,0x88,0x84,0x82,0xA0,0x40},
{0x04,0x0F,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x04,0x08,0x10,0x20,0x20,0x00,0x00}};/*“乐”*/
uchar code zhi[2][16]={{0x40,0x80,0x80,0x00,0xFE,0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x18,0x24,0xC2,0x00},
{0x00,0x00,0x00,0x00,0x1F,0x08,0x04,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x7F,0x00}};/*"之",0*/
uchar code sheng[2][16]={{0x80,0x80,0xFF,0x80,0xFE,0x00,0xFC,0x84,0x84,0xFC,0x04,0x04,0x04,0x02,0x02,0x01},
{0x00,0x00,0x7F,0x00,0x3F,0x00,0x1F,0x10,0x10,0x1F,0x00,0x00,0x00,0x00,0x00,0x00}};/*"声",0*/
void main()
{
while(1)
{
display (yin,yue,zhi,sheng);
}
}
因为在网上看到关于模块化程序的**说,不要在头文件里面定义变量,所以关于字码的二维数组定义就放在了main函数里面。当我把四个字码的数组定义放到lcd_display.h中之后,编译之后没有报错。程序没有问题了。 |