|
AVR的清屏例子,需要發(fā)送 0x01,和全部 GDRAM寫0x00。
//顯示清屏函數(shù)
void LCD_clear(void)
{
unsigned char x, y;
LCD_write_command(0x08); //避免清屏過程中閃爍,先關(guān)顯示
_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);
} |
|