Hello,
I'm working with the CFAF240320P LCD, fist I used the demostration code that you give but it doesnt work. After reading the controler datasheet I did a new code but I have some problems.
This is my initialization like it says in the datasheet (block diagram for turning it on). I'm working with a 16 bits interface by the way.
void initialization()
{
SET_RD;
SET_WR;
SET_CS;
SET_CD;
PTBD=0x00; // all data lines low
PTED=0x00; // all data lines low
CLR_RESET;
delay(10000);
delay(10000);
SET_RESET;
delay(500);
write_command(0x0003); // Power control (1)
write_data(0xA8A4);
delay(500);
write_command(0x000c); // Power control (2)
write_data(0x0004);
delay(500);
write_command(0x000D); // Power control (3)
write_data(0x000f);
delay(500);
write_command(0x000E); // Power control (4)
write_data(0x0000);
delay(500);
write_command(0x001E); // Power control (5)
write_data(0x0000);
delay(500);
write_command(0x0007); // Display control
write_data(0x0021); // GON = 1 DTE = 0
delay(500); // D[1:0] = 01 The internal display is performed although the display is off
write_command(0x0000); // Oscillation Start
write_data(0x0001); // The oscillator will be turned on when OSCEN = 1, off when OSCEN = 0
delay(500);
write_command(0x0007); // Display control
write_data(0x0023); // GON = 1 DTE = 0
delay(500); // D[1:0] = 11
write_command(0x0010); // Sleep Mode
write_data(0x0000);
delay(10000); // Wait 30 ms
write_command(0x0007); // Display control
write_data(0x0033); // GON = 1 DTE = 1
delay(500); // D[1:0] = 11
write_command(0x0011); // Entry mode
write_data(0x6F38);
delay(500);
write_command(0x0002); // LCD Drive AC control
write_data(0x06FF);
delay(500);
write_command(0x0001); // Driver output control
write_data(0x433F);
delay(500);
}
It do paint the screen but it does it slow, now Im painting windows colors in differents areas of the screen but the color arent the ones I suppose to be.
This is how I write the data and the commands, if I put the delays it becomes slower and in the end it do the same.
void write_command(unsigned int command)
{
PTBD= (unsigned char)(command & 0x00FF);
PTED= (unsigned char)(command>>8);
CLR_CD;
CLR_WR;
CLR_CS;
SET_RD;
// delay(10);
//SET_WR;
// delay(1000);
__RESET_WATCHDOG(); /* feeds the dog */
// delay(1000);
SET_CS;
SET_WR;
// delay(1000);
}
/*************************************************/
void write_data(unsigned int data)
{
PTBD=(unsigned char)(data & 0x00FF);
PTED=(unsigned char)(data>>8);
SET_CD;
CLR_WR;
CLR_CS;
SET_RD;
// delay(10);
//CLR_WR;
// delay(1000);
__RESET_WATCHDOG(); /* feeds the dog */
// delay(1000);
SET_CS;
SET_WR;
//delay(1000);
}
I'm painting the LCD with this colors,
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define WHITE 0xFFFF
BUT, every time i paint black its looks white, blue is looks like blue sky, green looks like white also and the red looks like yellow.
Is there any other changes or things I have to do before painting, or am I do it something wrong?
Does anybody have a code that do work?
Help,
Pascal.
I'm working with the CFAF240320P LCD, fist I used the demostration code that you give but it doesnt work. After reading the controler datasheet I did a new code but I have some problems.
This is my initialization like it says in the datasheet (block diagram for turning it on). I'm working with a 16 bits interface by the way.
void initialization()
{
SET_RD;
SET_WR;
SET_CS;
SET_CD;
PTBD=0x00; // all data lines low
PTED=0x00; // all data lines low
CLR_RESET;
delay(10000);
delay(10000);
SET_RESET;
delay(500);
write_command(0x0003); // Power control (1)
write_data(0xA8A4);
delay(500);
write_command(0x000c); // Power control (2)
write_data(0x0004);
delay(500);
write_command(0x000D); // Power control (3)
write_data(0x000f);
delay(500);
write_command(0x000E); // Power control (4)
write_data(0x0000);
delay(500);
write_command(0x001E); // Power control (5)
write_data(0x0000);
delay(500);
write_command(0x0007); // Display control
write_data(0x0021); // GON = 1 DTE = 0
delay(500); // D[1:0] = 01 The internal display is performed although the display is off
write_command(0x0000); // Oscillation Start
write_data(0x0001); // The oscillator will be turned on when OSCEN = 1, off when OSCEN = 0
delay(500);
write_command(0x0007); // Display control
write_data(0x0023); // GON = 1 DTE = 0
delay(500); // D[1:0] = 11
write_command(0x0010); // Sleep Mode
write_data(0x0000);
delay(10000); // Wait 30 ms
write_command(0x0007); // Display control
write_data(0x0033); // GON = 1 DTE = 1
delay(500); // D[1:0] = 11
write_command(0x0011); // Entry mode
write_data(0x6F38);
delay(500);
write_command(0x0002); // LCD Drive AC control
write_data(0x06FF);
delay(500);
write_command(0x0001); // Driver output control
write_data(0x433F);
delay(500);
}
It do paint the screen but it does it slow, now Im painting windows colors in differents areas of the screen but the color arent the ones I suppose to be.
This is how I write the data and the commands, if I put the delays it becomes slower and in the end it do the same.
void write_command(unsigned int command)
{
PTBD= (unsigned char)(command & 0x00FF);
PTED= (unsigned char)(command>>8);
CLR_CD;
CLR_WR;
CLR_CS;
SET_RD;
// delay(10);
//SET_WR;
// delay(1000);
__RESET_WATCHDOG(); /* feeds the dog */
// delay(1000);
SET_CS;
SET_WR;
// delay(1000);
}
/*************************************************/
void write_data(unsigned int data)
{
PTBD=(unsigned char)(data & 0x00FF);
PTED=(unsigned char)(data>>8);
SET_CD;
CLR_WR;
CLR_CS;
SET_RD;
// delay(10);
//CLR_WR;
// delay(1000);
__RESET_WATCHDOG(); /* feeds the dog */
// delay(1000);
SET_CS;
SET_WR;
//delay(1000);
}
I'm painting the LCD with this colors,
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define WHITE 0xFFFF
BUT, every time i paint black its looks white, blue is looks like blue sky, green looks like white also and the red looks like yellow.
Is there any other changes or things I have to do before painting, or am I do it something wrong?
Does anybody have a code that do work?
Help,
Pascal.
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.