麻烦高手注释一下这个程序
#include <AT89X051.H> //调用AT89X051.H头文件AT89C2051专用
#define uint unsigned int //定义一下好看
#define uchar unsigned char //定义一下好看
#define guanxian 0x3e //定义关显示为16进制的0x3e
#define kaixian 0x3f //定义开显示为16进制的0x3f
#define ye 0xb8 //定义页为16进制的0xb8
#define lie 0x40 //定义列为16进制的0x40
#define hang 0xc0 //定义行为16进制的0xc0
/*定义一个无符号字符型数组《uchar》数组为《cheng“成”》放到
《code“就是rom里面不能改动,断电后数据不消失”》*/
uchar code cheng[]= //成的16进制代码
{
0x00,0x00,0xF8,0x48,0x48,0x48,0xC8,0x08,0xFF,0x08,0x09,0x0A,0xC8,0x88,0x08,0x00,
0x40,0x30,0x0F,0x00,0x08,0x50,0x4F,0x20,0x10,0x0B,0x0C,0x12,0x21,0x40,0xF0,0x00,
};
uchar code du[]= //都的16进制代码
{
0x20,0x24,0x24,0xA4,0x7F,0x24,0x34,0x28,0x24,0x00,0xFE,0x22,0x52,0x8A,0x06,0x00,
0x04,0x02,0x7F,0x25,0x25,0x25,0x25,0x7F,0x00,0x00,0xFF,0x08,0x08,0x10,0x0F,0x00,
};
uchar code xi[]= //熙的16进制代码
{0x00,0xFE,0x02,0x72,0x52,0xDE,0x72,0x02,0x00,0xFE,0x12,0x12,0x12,0x3E,0x80,0x00,
0x40,0x67,0x3A,0x02,0x0A,0x33,0x62,0x02,0x08,0x31,0x62,0x02,0x0A,0x32,0x63,0x00,
};
uchar code nan[]= //南的16进制代码
{0x04,0x04,0xE4,0x24,0x24,0x64,0xB4,0x2F,0x24,0xA4,0x64,0x24,0x24,0xE6,0x04,0x00,
0x00,0x00,0x7F,0x04,0x05,0x05,0x05,0x7F,0x05,0x05,0x05,0x25,0x44,0x3F,0x00,0x00,
};
uchar code yi[]= //一的16进制代码
{0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xC0,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
uchar code ka[]= //卡的16进制代码
{
0x00,0x40,0x40,0x40,0x40,0x40,0x40,0xFF,0x44,0x44,0x44,0x44,0x44,0x44,0x40,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x02,0x04,0x0C,0x38,0x10,0x00,0x00,
};
uchar code tong[]= //通的16进制代码
{
0x40,0x41,0xC6,0x00,0x00,0xF2,0x52,0x52,0x56,0xFA,0x5A,0x56,0xF2,0x00,0x00,0x00,
0x40,0x20,0x1F,0x20,0x40,0x5F,0x42,0x42,0x42,0x5F,0x4A,0x52,0x4F,0x40,0x40,0x00,
};
uchar code ke[]= //科的16进制代码
{
0x00,0x40,0x48,0x48,0xF8,0xA4,0xA2,0x00,0x28,0x50,0x00,0xFF,0x80,0x80,0x80,0x00,
0x08,0x04,0x02,0x01,0x3F,0x00,0x00,0x01,0x01,0x01,0x01,0x7F,0x00,0x00,0x00,0x00,
};
sbit lcdrst=P3^5; //定义P3^5为lcdrst 复位
sbit lcdcs2=P3^1; //定义P3^1为lcdcs2 片选2
sbit lcdcs1=P3^0; //定义P3^0为lcdcs1 片选1
sbit lcde=P3^4; //定义P3^4为lcde 读\写使能
sbit lcdrw=P3^3; //定义P3^3为lcdrw 读\写 选择
sbit lcdrs=P3^2; //定义P3^2为lcdrs 数据\指令 选择RS=0写指令,RS=1写数据
void delay(uint z) //延时函数
{
uint x,y;
for(x=z;x>0;x--)
for(y=124;y>0;y--);
}
void write_com(uchar com)//写命令子函数
{
lcdrs=0; //RS=0写指令
lcdrw=0; //RW=0读写选择写
P1=com; //P1为com(写入的命令)
delay(1); //调用1次delay的延时函数
lcde=1; //E=1开启命令显示(使能)
delay(1); //调用1次delay函数
lcde=0; //E=0关闭命令显示(关闭使能)
}
void write_data(uchar dat) //写数据子函数
{
lcdrs=1; //RS=1写数据
lcdrw=0; //RW=0选择写
P1=dat; //P1为写的数据
delay(1); //调用1次delay的延时函数
lcde=1; //E=1开启数据显示(使能)
delay(1); //调用一次delay的延时函数
lcde=0; //E=0关闭数据显示(关闭使能)
}
void initlcd() //初始化12864
{
write_com(guanxian); //写命令 关显示
write_com(kaixian); //写命令 开显示
write_com(ye); //写命令 页
write_com(lie); //写命令 列
write_com(hang); //写命令 行
}
void cleanlcd() //清屏
{
uchar i,j;
for(i=0;i<8;i++) //控制页数0-7,共8页
{
write_com(ye+i); //控制页地址《ye=0xb8》自动加i
write_com(lie); //控制列地址《lie=0x40》
for(j=0;j<64;j++)//控制列数0-63,共64列
write_data(0x00);//写数据(write_data)内容为0x00,列地址自动加1
}
}
void dis(uchar yes,uchar lies,uchar *hz) //定义显示页,列,行
{
uchar i,j;
for(i=0;i<2;i++) //控制页数,0-1共2页
{
write_com(ye+yes+i); //写命令页,自动加1
write_com(lie+lies); //写命令列
for(j=0;j<16;j++) //控制列数0-15,共16列
write_data(hz[16*i+j]); //写汉字内容,地址自动加1
}
}
void displaylcd() //显示函数
{
lcdcs1=1; //cs1为高
lcdcs2=0; //cs2为低 左屏显示
dis(0,0,cheng); //在0x0的地方显示 成
dis(0,16,du); //在0x16的地方显示 都
dis(0,32,xi); //在0x32的地方显示 熙
dis(0,48,nan); //在0x48的地方显示 南
lcdcs1=0; //cs1为低
lcdcs2=1; //cs2为高 右屏显示
dis(0,0,yi); //在0x0的地方显示 一
dis(0,16,ka); //在0x
dis(0,32,tong); //在0x32的地方显示 通
dis(0,48,ke); //在0x48的地方显示 科
}
void main()//主函数
{
initlcd(); //初始化12864
cleanlcd(); //清屏
displaylcd(); //显示函数
while(1); //循环执行以上程序
}
求高手详细注释
注释挺详细的啊!
求每一行的注释