- #include
- #include
- #include
- #define uchar unsigned char
- #define uint unsigned int
- void delay(uchar x);
- void wrcom(uchar);
- void wrdata(uchar );
- ***it rs=0xb0^7;//0xb0是P3的字节地址,这样可少按一次shift键。
- ***it wr=0xb0^6;
- ***it e=0xb0^5;
- ***it cs2=0xb0^4;
- ***it cs1=0xb0^3;
- ***it d=P1^0;
- //void checkbusy();
- uchar code datable[24][16]={/*-- 文字: 单 --*/
- /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
- 0x00,0x00,0xF8,0x49,0x4A,0x4C,0x48,0xF8,0x48,0x4C,0x4A,0x49,0xF8,0x00,0x00,0x00,
- 0x10,0x10,0x13,0x12,0x12,0x12,0x12,0xFF,0x12,0x12,0x12,0x12,0x13,0x10,0x10,0x00,
- /*-- 文字: 片 --*/
- /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
- 0x00,0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x00,0x00,
- 0x00,0x80,0x60,0x1F,0x02,0x02,0x02,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x00,
- /*-- 文字: 机 --*/
- /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
- 0x10,0x10,0xD0,0xFF,0x90,0x10,0x00,0xFE,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,
- 0x04,0x03,0x00,0xFF,0x00,0x83,0x60,0x1F,0x00,0x00,0x00,0x3F,0x40,0x40,0x78,0x00,
- /*-- 文字: 学 --*/
- /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
- 0x40,0x30,0x11,0x96,0x90,0x90,0x91,0x96,0x90,0x90,0x98,0x14,0x13,0x50,0x30,0x00,
- 0x04,0x04,0x04,0x04,0x04,0x44,0x84,0x7E,0x06,0x05,0x04,0x04,0x04,0x04,0x04,0x00,
- /*-- 文字: 习 --*/
- /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
- 0x00,0x02,0x02,0x02,0x12,0x22,0xC2,0x02,0x02,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,
- 0x00,0x08,0x18,0x08,0x04,0x04,0x04,0x02,0x02,0x41,0x81,0x40,0x3F,0x00,0x00,0x00,
- /*-- 文字: , --*/
- /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x58,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- /*-- 文字: 真 --*/
- /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
- 0x00,0x04,0x04,0xF4,0x54,0x54,0x54,0x5F,0x54,0x54,0x54,0xF4,0x04,0x04,0x00,0x00,
- 0x10,0x10,0x90,0x5F,0x35,0x15,0x15,0x15,0x15,0x15,0x35,0x5F,0x90,0x10,0x10,0x00,
- /*-- 文字: 的 --*/
- /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
- 0x00,0xF8,0x0C,0x0B,0x08,0x08,0xF8,0x40,0x30,0x8F,0x08,0x08,0x08,0xF8,0x00,0x00,
- 0x00,0x7F,0x21,0x21,0x21,0x21,0x7F,0x00,0x00,0x00,0x43,0x80,0x40,0x3F,0x00,0x00,
- /*-- 文字: 有 --*/
- /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
- 0x04,0x04,0x04,0x84,0xE4,0x3C,0x27,0x24,0x24,0x24,0x24,0xE4,0x04,0x04,0x04,0x00,
- 0x04,0x02,0x01,0x00,0xFF,0x09,0x09,0x09,0x09,0x49,0x89,0x7F,0x00,0x00,0x00,0x00,
- /*-- 文字: 点 --*/
- /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
- 0x00,0x00,0xC0,0x40,0x40,0x40,0x7F,0x48,0x48,0x48,0x48,0xC8,0x08,0x08,0x00,0x00,
- 0x80,0x40,0x37,0x04,0x04,0x14,0x64,0x04,0x14,0x64,0x04,0x07,0x10,0xE0,0x00,0x00,
- /*-- 文字: 难 --*/
- /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
- 0x04,0x24,0xC4,0x04,0xE4,0x5C,0x20,0xF8,0x4F,0x48,0x49,0xFA,0x48,0x48,0x08,0x00,
- 0x20,0x10,0x0C,0x03,0x04,0x18,0x00,0xFF,0x22,0x22,0x22,0x3F,0x22,0x22,0x20,0x00,
- /*-- 文字: ! --*/
- /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
- 0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
- };
-
- void delay(uchar x)
- {
- uchar a=100;
- while(x--)
- while(a--);
- }
- /* void checkbusy()
- {
- uchar a;
- // P2=0xff;
- wr=1;
- rs=0;
-
- e=1;
- while(1)
- {
- //d=0;
- e=0;
- a=P2;
- while(!(a&0x80))
-
- break;
- d=0;
- e=1;
- //P1=0;
- }
- }*/
- void wrcom( uchar com)
- {
- // checkbusy();//加忙检测后,数据正常无显示,没搞懂。
- rs=0;
- wr=0;
- e=1;
- P2=com;
- _nop_();
- e=0;
- }
- void wrdata(uchar data0)
- {
- //checkbusy();
- rs=1;
- wr=0;
- e=1;
- P2=data0;
- delay(1);
-
- e=0;
- }
-
-
-
- void main()
- {
- uchar i,j;
-
- wrcom(0x0c);
- wrcom(0x30);
- wrcom(0x01);
- wrcom(0x06);
- while(1)
- {
-
- cs1=0;//左屏显示第一、第二、第三、第四(第一行)和第七、第八、第九、第十(第二行)八个字。
- cs2=1;
- wrcom(0xb8); //左屏第一行第一页
-
- for(i=0;i<4;i++)
- {
- wrcom(0x40+16*i);//第一列开始
- for(j=0;j<16;j++)
- {
-
- wrdata(datable[2*i][j]);
- }
- }
- wrcom(0xb9); //左屏第一行第二页
-
- for(i=0;i<4;i++)
- {
- wrcom(0x40+16*i);//第一列开始
- for(j=0;j<16;j++)
- {
-
- wrdata(datable[2*i+1][j]);
- }
- }
- wrcom(0xbc); delay(1);//左屏第二行第五页
-
- for(i=6;i<10;i++)
- {
- wrcom(0x40+16*(i-6));//第一列
- for(j=0;j<16;j++)
- {
-
- wrdata(datable[2*i][j]);
- }
- }
- wrcom(0xbd); delay(1);//左屏第二行第六页
-
- for(i=6;i<10;i++)
- {
- wrcom(0x40+16*(i-6));//第一列
- for(j=0;j<16;j++)
- {
-
- wrdata(datable[2*i+1][j]);
- }
- }
-
- cs1=1;//右屏显示第五、第六(第一行)和第十一、第十二(第二行)共四个字。
- cs2=0;
- wrcom(0xb8); //右屏第一行第一页
-
- for(i=4;i<6;i++)
- {
- wrcom(0x40+16*(i-4));//第一列
- for(j=0;j<16;j++)
- {
-
- wrdata(datable[2*i][j]);
- }
- }
- wrcom(0xb9); delay(1);//右屏第一行第二页
-
- for(i=4;i<6;i++)
- {
- wrcom(0x40+16*(i-4));//第一列
- for(j=0;j<16;j++)
- {
-
- wrdata(datable[2*i+1][j]);
- }
- }
- wrcom(0xbc); delay(1);//右屏第二行第五页
-
- for(i=10;i<12;i++)
- {
- wrcom(0x40+16*(i-10));//第一列
- for(j=0;j<16;j++)
- {
-
- wrdata(datable[2*i][j]);
- }
- }
- wrcom(0xbd); //右屏第二行第六页
-
- for(i=10;i<12;i++)
- {
- wrcom(0x40+16*(i-10));//第一列
- for(j=0;j<16;j++)
- {
-
- wrdata(datable[2*i+1][j]);
- }
- }
-
- }
-
- }
复制代码
0
|
|
|
|