单片机+lcd12864液晶万年历C程序
/*------------------------------------
GDRAM绘16x32图
------------------------------------*/
void LCD_SendImg16x32(UINT8 x,UINT8 y,UINT8 *img,bit g)//x标志表示是否反白。
{
UINT8 i,j,base_x;
LCD_WriteCommand(0x34);
LCD_WriteCommand(0x36);
switch(y)
{
case 0: base_x=0x80;break;
case 1: base_x=0x90;break;
case 2: base_x=0x88;break;
default:return;
}
if(y==0||y==2)
{
for(i=0;i<32;i++)
{
LCD_WriteCommand(0x80+i);
LCD_WriteCommand(base_x+x);
for(j=0;j<2;j++)
{
if(!g)
LCD_WriteData(*img++);
else LCD_WriteData(~(*img++));
}
}
}
if(y==1)
{
for(i=0;i<16;i++)
{
LCD_WriteCommand(0x90+i);
LCD_WriteCommand(base_x+x);
for(j=0;j<2;j++)
{
if(g)
LCD_WriteData(~(*img++));
else
LCD_WriteData(*img++);
}
}
for(i=0;i<16;i++)
{
LCD_WriteCommand(0x80+i);
LCD_WriteCommand(base_x+x+8);
for(j=0;j<2;j++)
{
if(g)
LCD_WriteData(~(*img++));
else
LCD_WriteData(*img++);
}
}
}
LCD_WriteCommand(0x36);
//LCD_WriteCommand(0x30);
}
/*------------------------------------
GDRAM绘制128x64
------------------------------------*/
void LCD_SendImg128x64(UINT8 *img)
{
UINT8 i,j;
//LCD_WriteCommand(0x30);
LCD_WriteCommand(0x36);
for(i=0;i<32;i++)
{
LCD_WriteCommand(0x80+i);
LCD_WriteCommand(0x80);
for(j=0;j<16;j++)
{
LCD_WriteData(*img++);
}
}
for(i=0;i<32;i++)
{
LCD_WriteCommand(0x80+i);
LCD_WriteCommand(0x88);
for(j=0;j<16;j++)
{
LCD_WriteData(*img++);
}
}
LCD_WriteCommand(0x36);
}
/*------------------------------------
清除GDRAM
------------------------------------*/
void LCD_ClearGDRAM()
{
UINT8 i,j;
LCD_WriteCommand(0x30);//一般指令
LCD_WriteCommand(0x0C); //开启显示
LCD_WriteCommand(0x06); //AC++
LCD_WriteCommand(0x01);//清DDRAM
LCD_WriteCommand(0x36);//开启绘图
//LCD_InitGDRAM();
LCD_WriteCommand(0x36);//显示绘图
for(i=0;i<32;i++)//在DGRAM里写满0,表示清除GDRAM
{
LCD_WriteCommand(0x80+i);
LCD_WriteCommand(0x80);
for(j=0;j<16;j++)
{
LCD_WriteData(0x00);
LCD_WriteData(0x00);
}
}
LCD_WriteCommand(0x36);//绘图完毕,开启显示
}
/*------------------------------------
清除1,2,3行屏
------------------------------------*/
void LCD_ClearScreen123()
{
LCD_WriteCommand(0x30);
LCD_WriteCommand(0x90);
LCD_SendString(" ");
LCD_WriteCommand(0x88);
LCD_SendString(" ");
LCD_WriteCommand(0x98);
LCD_SendString(" ");
}
/*------------------------------------
菜单选择更新
------------------------------------*/
void LCD_RefreshMenu()
{
LCD_ClearScreen123();
LCD_WriteCommand(0x90);
if(0+(guide/3)*3
LCD_WriteCommand(0x88);
if(1+(guide/3)*3
LCD_WriteCommand(0x98);
if(2+(guide/3)*3
switch(guide%3)
{
case 0: LCD_WriteCommand(0x90);break;
case 1: LCD_WriteCommand(0x88);break;
case 2: LCD_WriteCommand(0x98);break;
default:return ;
}
LCD_DisplayCGRAM(1);
}
#endif
单片机lcd12864液晶万年 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)