单片机 12864lcd 滚动显示
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x24,0xE4,0xFC,0xA2,0x22,0x22,0x80,0x70,0x00,0xFF,0x40,0x20,0x18,0x00,0x00,
0x02,0x01,0x00,0xFF,0x00,0x83,0x40,0x20,0x18,0x07,0x01,0x06,0x18,0xE0,0x40,0x00,0x00,0x18,0x0A,0xAA,0xAA,0xAA,0x0A,0xFE,0x0A,0xAA,0xAA,0xAA,0x0A,0x18,0x08,0x00,
0x00,0x00,0x42,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0xFE,0x00,0x00,0x00,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,0x00,0x00,0xF8,0x01,0x06,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0xFE,0x00,0x00,
0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x7F,0x00,0x00,0x08,0x31,0x06,0xC0,0x30,0x00,0xF8,0x08,0x0C,0x0B,0x08,0x08,0x08,0xF8,0x00,0x00,
0x02,0x02,0xFF,0x00,0x00,0x00,0xFF,0x41,0x41,0x41,0x41,0x41,0x41,0xFF,0x00,0x00,0x00,0x04,0x04,0xC4,0xB4,0x8C,0x87,0x84,0xF4,0x84,0x84,0x84,0x84,0x04,0x00,0x00,
0x00,0x00,0x20,0x18,0x0E,0x04,0x20,0x40,0xFF,0x00,0x02,0x04,0x18,0x30,0x00,0x00,0x00,0x00,0x80,0xBE,0xA2,0xA2,0xA2,0xA2,0xA2,0xA2,0xA2,0xBE,0x80,0x00,0x00,0x00,
0x84,0x84,0x44,0x44,0x24,0x14,0x0C,0x07,0x0C,0x14,0x24,0x64,0xC4,0x44,0x04,0x00,0x00,0x02,0x02,0x02,0x02,0x82,0x7E,0x22,0x22,0x22,0x22,0xF2,0x22,0x02,0x02,0x00,
0x00,0x40,0x20,0x10,0x0C,0x03,0x00,0x00,0x20,0x60,0x20,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x91,0x91,0x91,0x91,0xFF,0x91,0x91,0x91,0x91,0xFF,0x00,0x00,0x00,
0x40,0x40,0x44,0x44,0x44,0x44,0x44,0x7F,0x44,0x44,0x44,0x44,0x44,0x40,0x40,0x00,0x80,0x80,0xFC,0x96,0xA5,0xFC,0x80,0x40,0x3E,0x02,0x02,0x02,0x7E,0x40,0x40,0x00,
0x80,0x60,0x1F,0x42,0x84,0x7F,0x00,0x00,0x7E,0x22,0x22,0x22,0x22,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x18,0x24,0x24,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
//延时函数
void delay(unsigned int t)
//写命令
void write_com(unsigned char cmdcode)
//写数据
void write_data(unsigned char Dispdata)
//清屏
void Clr_Scr()
//显示汉字.汉字的显示是先显示第一页,再显示第二页.
void hz_disp16(unsigned char pag,unsigned char col, unsigned char code *hzk)
{
unsigned char j=0,i=0;
for(j=0;j<2;j++)
{
write_com(Page_Add+pag+j);
delay(3);
write_com(Col_Add+col);
delay(3);
for(i=0;i<16;i++)
{
write_data(hzk[16*j+i]);
delay(3);
}
}
}
//显示字母
void hz_disp8(unsigned char pag,unsigned char col,unsigned char code *hzk)
{
unsigned char j=0,i=0;
for(j=0;j<2;j++)
{
write_com(Page_Add+pag+j);
delay(3);
write_com(Col_Add+col);
delay(3);
for(i=0;i<8;i++)
write_data(hzk[8*j+i]);
delay(3);
}
}
//初始化
void init_lcd()
{
delay(10);
cs1=1;
cs2=1;
delay(10);
write_com(Disp_Off);
write_com(Page_Add+0);
write_com(st_line+0);
write_com(Col_Add+0);
write_com(Disp_On);
}
void main()
{
int pag=0,col=0,zishu=0; //zishu用来统计显示的字数
init_lcd();
Clr_Scr();
cs1=1;cs2=1;
delay(10);
cs1=1;cs2=0;
while(1)
{
hz_disp16(pag,col,dat[zishu]);
delay(delaytime);
zishu++;
col=col+16;
if(col==64)
col=0;
if(!(zishu%4)) //当显示的字数为4,12,28时在左半屏
{cs1=0;cs2=1;}
if(!(zishu%8)) //当显示的字数为8,16,32时在右半屏,并且右半屏显示完之后,页数加2。因为汉字占用的空间为16*16,8行为一页
{cs1=1;cs2=0;pag+=2;}
if(!(zishu%32))
{
st_line+=3; //当显示完32个字的时候,起始行加一,达到滚动效果
if(st_line>=0xff)
st_line=Start_Line;
单片机12864lcd滚动显 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)