After some research and some help from u guys I have a "plot-pixel"-function ready 2 use. It is not well coded but it works
Here it is:
Code:
void Plot(int X, int Y, int mode)
{
unsigned char pixelvalue = 0x10;
if ((X>-1) && (X<128) && (Y>-1) && (Y<64))
{
if (mode==0) arrayLCD[(X>>3)+(Y<<7)] = arrayLCD[(X>>3)+(Y<<7)] & (255-(1<<(7-(X&7))));
if (mode==1) arrayLCD[(X>>3)+(Y<<7)] = arrayLCD[(X>>3)+(Y<<7)] | 1<<(7-(X&7));
if (mode==2) arrayLCD[(X>>3)+(Y<<7)] = arrayLCD[(X>>3)+(Y<<7)] ^ 1<<(7-(X&7));
SetColumn(X);
switch(Y%8)
{
case 0: pixelvalue = 0x01; break;
case 1: pixelvalue = 0x02; break;
case 2: pixelvalue = 0x04; break;
case 3: pixelvalue = 0x08; break;
case 4: pixelvalue = 0x10; break;
case 5: pixelvalue = 0x20; break;
case 6: pixelvalue = 0x40; break;
case 7: pixelvalue = 0x80; break;
default: pixelvalue = 0x10;
}
if(Y<8)
{ SetPage(0);}
else if(Y>=8 && Y<16)
{ SetPage(1);}
else if(Y>=16 && Y<24)
{ SetPage(2);}
else if(Y>=24 && Y<32)
{ SetPage(3);}
else if(Y>=32 && Y<40)
{ SetPage(4);}
else if(Y>=40 && Y<48)
{ SetPage(5);}
else if(Y>=48 && Y<56)
{ SetPage(6);}
else
{ SetPage(7);}
SendLCDData(&pixelvalue,1);
}
}
Still I don't know if I need the array, but I think it's nice 2 have if u want 2 check if the pixel is on or off. Must say THX 2 Micheal 4 the excellent idea about "Y%8"
Note: This function is for KS0108, not tested with other controllers.
Have fun
Kneego