AVR的清屏例子,需要发送 0x01,和全部 GDRAM写0x00。
//显示清屏函数
void LCD_clear(void)
{
unsigned char x, y;
LCD_write_command(0x08); //避免清屏过程中闪烁,先关显示
_delay_us(100);
LCD_write_command(0x01); //清DDRAM
//清GDRAM,12864仅用了一半的GDRAM,清一半即可
//如果没有使用到绘图GDRAM,也可以不清GDRAM,省点时间和代码空间
LCD_startGraphic();
for (y = 0; y < 32; y++)
{
LCD_write_command(0x80 + y); //y
LCD_write_command(0x80 + 0); //x
for (x = 0; x < 16; x++)
{
LCD_write_data(0x00);
LCD_write_data(0x00);
}
}
LCD_endGraphic();
LCD_write_command(0x0C); //显示开
_delay_ms(10);
} |