hi,
I've got a problem with my new lcd 6100 with the sparkfun board. it lights up but nothing gets displayed, although i set it up to display a square in the middle.
anyway here's mine line code:
#include <at89c5131.h>
sfr p1= 0x90;
sfr p2= 0xa0;
sfr spcon= 0xc3;
sfr spsta= 0xc4;
sfr spdata= 0xc5;
sbit res_lcd= p1^ 1;
sbit spd= p1^ 7;
sbit spc= p1^ 6;
sbit spen= 0xc3^ 6;
sbit spif= 0xc4^ 7;
char xdata lcd_con _at_ 0x1000;
char xdata lcd_data _at_ 0x1100;
char code lcd[6][27] ={{0,126,36,66,66,0},
{0,36,18,18,36,56}};
void sp_data(unsigned char dat1);
void sp_com(unsigned char op);
void start_lcd();
void pic();
void delay();
void delay()
{
int i,j;
for(j=2;j!=0;j--)
{
for(i=250;i!=0;i--);
}
}
void lcd_put_pixel(unsigned char color,unsigned char x,unsigned char y)
{
sp_com(0x75);sp_data(x);sp_data(132);
sp_com(0x15);sp_data(y);sp_data(131);
sp_com(0x5c); sp_data(color);
}
void sp_com(unsigned char op)
{
int i;unsigned char test;
p2=0x7f;
spdata=0x0;
while(spif==0);
delay();
p2=0xff;
delay();
p2=0x7f;
delay();
}
spdata=op;
while(spif==0);
delay();
p2=0xff;
delay();
}
void sp_data(unsigned char dat1)
{
int i;
p2=0x7f;
delay();
for (i=0;i<100;i++);
while(spif==0);
delay();
p2=0xff;
delay();
p2=0x7f;
delay();
spdata=dat1;
while(spif==0);
delay();
p2=0xff;
delay();
}
void start_lcd()
{
int i,j,k;
unsigned char colors[20]={0,2,4,6,8,10,12,15,0,2,4,6,8,10,12,15,0,4,9,15};
sp_com(0xca);sp_data(0x03);sp_data(32);sp_data(12);sp_data(0x00); //Control the Display
sp_com(0xbb);sp_data(0x01); //Scan Direction
sp_com(0xd1); //internal Oscillation
sp_com(0x94); //Sleep Out
for (k=0;k<200;k++) delay();
sp_com(0x81);sp_data(5);sp_data(0x01);//Electronic Volume defines the Contrast/Brighness of the Lcd
sp_com(0x20);sp_data(0x0f);delay();//Power Control-EveryThing On
sp_com(0xa7);//Inverse Display
sp_com(0xbc);sp_data(0x00);sp_data(0);sp_data(0x01);sp_data(0x00);//Data Scan Direction Control
sp_com(0xce);//256 Color Mode
for(i=0;i!=20;i++) sp_data(colors[i]);
sp_com(0x75);sp_data(2);sp_data(131);// Y Coordinate
sp_com(0x15);sp_data(0);sp_data(131);// X Coordinate
sp_com(0x5c);
for (j=0;i<18000;i++) sp_data(28);// Background Is green
for (k=0;k<200;k++) delay();
sp_com(0xaf);
for (k=0;k<200;k++) delay();
for (i=0;i<160;i++){
sp_com(0xd6);
delay ();
}
for (i=0;i<4096;i++) lcd_put_pixel(i,(i%64)+32,(i/64)+32);
}
void main()
{
p2=0x7f;
res_lcd=1;
delay();
res_lcd=0;
delay();
res_lcd=1;
delay();
spcon=0xdd;//Cpol=1 Cpha=1 etc..
p2=0xff;
start_lcd();
}
any help with the problem will be deeply aprriceted (i'ts for my bsc tech diploma)
And of course thank you very much from the start.
