谢谢大神,还有个问题想请教一下,就是下面这段程序中为什么需要写0x01~0x07送到0x80
我改成像你的程序那种直接写完0x40然后送数据就显示不了
- #include <REGX51.H>
- #define uchar unsigned char
- #define uint unsigned int
- #define sc P0
- sbit rs=P2^6;
- sbit rw=P2^5;
- sbit e=P2^7;
- //uchar code table[]={0x1F,0x04,0x04,0x1F,0x04,0x05,0x1F,0x00};
- uchar code table[]={
- 0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,//一
- 0x00,0x00,0x0E,0x00,0x1F,0x00,0x00,0x00,//二
- 0x00,0x1F,0x00,0x0E,0x00,0x1F,0x00,0x00,//三
- 0x02,0x04,0x0F,0x12,0x0F,0x0A,0x1F,0x02,//年
- 0x0F,0x09,0x0F,0x09,0x0F,0x09,0x09,0x11,//月
- 0x1F,0x11,0x11,0x1F,0x11,0x11,0x1F,0x00,//日
- 0x00,0x00,0x00,0x0A,0x15,0x0A,0x04,0x00,//心型
- 0x00,0x04,0x15,0x0E,0x1F,0x0E,0x11,0x00//坦克
- };
- uchar code table1[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07}; //自定义字符数据地址
- uchar code table2[]="QQ:1045964948";
- void xie_date(uchar sj);
- void xie_ml(uchar ml);
- void delay(uint t);
- void init();
- void delay(uint t)
- {
- while(t--);
- }
- void xie_date(uchar sj)
- {
- rs=1;
- rw=0;
- e=0;
- sc=sj;
- e=1;
- delay(500);
- e=0;
- }
- void xie_ml(uchar ml)
- {
- rs=0;
- rw=0;
- e=0;
- sc=ml;
- e=1;
- delay(500);
- e=0;
- }
- void init()
- {
- xie_ml(0x38);
- xie_ml(0x0c);
- xie_ml(0x06);
- xie_ml(0x01);
- xie_ml(0x80);
- }
- void main()
- {
- uchar i;
- init();
- while(1)
- {
- xie_ml(0x40);
- for(i=0;i<64;i++)
- {
- xie_date(table[i]);
- delay(50);
- }
- xie_ml(0x80);
- for(i=0;i<8;i++)
- {
- xie_date(table1[i]);
- delay(50);
- }
- xie_ml(0xc0);
- for(i=0;i<13;i++)
- {
- xie_date(table2[i]);
- delay(50);
- }
- }
- }
复制代码 |