char DATA_TAB[1024]; //screen buffer
void InitLCD_ST7920(void) {
unsigned char x, y;
Delay_us(20);
Ssd_Command(0x30); //basic mode, 8bit interface
Ssd_Command(0x0C); //LCD on
Ssd_Command(0x01); //Display clear TEXT
Ssd_Command(0x02); //Return to home
Ssd_Command(0x36); //Graph Mode 8bit interface, graph on
for (y = 0; y < 32; y++) //clear graphic RAM
{
Ssd_Command(0x80 | y); //y
Ssd_Command(0x80); //x
for (x = 0; x < 32; x++) {
Ssd_Data(0);
}
}
}
void freshscreen_ST7920(void) {
volatile unsigned int ptr;
ptr = 0;
Ssd_Command(0x36); //Graph Mode 8bit interface, graph on
for (unsigned char i = 0; i < 32; i++) {
Ssd_Command(0x80 + i); //set low column address
Ssd_Command(0x80); //set high column address 10
for (char j = 0; j < 16; j++) {
Ssd_Data(DATA_TAB[ptr++]);
}
}
for (char i = 0; i < 32; i++) {
Ssd_Command(0x80 + i); //set low column address
Ssd_Command(0x88); //set high column address 10
for (char j = 0; j <16; j++) {
Ssd_Data(DATA_TAB[ptr++]);
}
}
}