Tem um driver pra esse LCD que consome muita memoria pra aplicaçoes de baixo custo, vamos tentar resolver isso ?
Segue parte do codigo do driver:
cpp code
typedef union
{
int16 world;
int8 nbyte[2];
} Dots;
typedef struct
{
int1 refresh;
Dots pix[YVAL][XVAL]; // Max dimensions for display (x,y) = (128,32)
} GD_RAM; // (0,0) corresponds to upper lefthand corner.
GD_RAM gdram;
void glcd_data(unsigned char x){
glcd_check_busy();
output_high(rs); // HIGH RS and LOW RW will put the lcd to
output_low(rw); // Write data register mode
output_d(x);
output_high(e);
delay_us(1);
output_low(e);
}
void glcd_update ()
{
int8 v, h;
if (gdram.refresh)
{
for (v=0; v <YVAL; v++)
{
glcd_instruction( 0x80 | v); // Set Vertical Address.
glcd_instruction( 0x80 | 0); // Set Horizontal Address.
for (h=0; h <XVAL; h++)
{
glcd_data( gdram.pix[v][h].nbyte[1]); // Write High Byte.
glcd_data( gdram.pix[v][h].nbyte[0]); // Write Low Byte.
}
}
gdram.refresh = FALSE;
}
}
void glcd_pixel(int8 x, int8 y, int1 color)
{
int8 v, h, b;
if(y>31){x += 128; y-= 32;};
v = y;
h = x/16;
b = 15 - (x%16);
if (color == ON) bit_set (gdram.pix[v][h].world, b);
else bit_clear (gdram.pix[v][h].world, b);
gdram.refresh = TRUE;
}
Essas instruçoes são as mais basicas pra escrever na tela desse display. Repare que sempre tem que usar a rotina glcd_update(); pra gravar na tela do LCD.
Veja, a variavel gdram consome 512bytes da preciosa memoria RAM do Mcu, será que poderiamos alterar isso pra bem menos ?