Function CFAF320240F-T

alexmarques

New member
I'm using the display CFAF320240FT and SPI communication with PIC18F46J50 and I can not turn on any pixel. Can anyone help me, below is the piece of code:


Code:
//Função responsável por fazer um delay em número de pulso
//----------------------------------------------------------------
void delay(unsigned int t)
{
	unsigned char t1;
	while(t--)
	for(t1=11;t1>0;t1--)
	{
		Nop();
	}
}
//----------------------------------------------------------------

//Escreve um comando de 8 bits para o display via SPI
//----------------------------------------------------------------
void write_command(unsigned char command)
{
	uint8 envia;
	
	Nop();
	SET_RD;
	Nop();
	CLR_CS;   // chip selected
	Nop();
	CLR_CD;   // command mode -> 0 quando comando
	Nop();
	CLR_WR;
	Nop();

	envia = WriteSPI1(command);	// set up data on bus

	// clock WR
	Nop();
	SET_WR;
	Nop();
	SET_CS;   // deselect chip
}
//----------------------------------------------------------------

//Escreve um dado de 16 bits para o display
//----------------------------------------------------------------
void write_data(unsigned int data)
{
	uint8 envia;
	
	SET_CD;       // data mode
	Nop();
	SET_RD;
	Nop();
	CLR_CS;       // chip selected
	Nop();
	CLR_WR;
	Nop();

	envia = WriteSPI1(data>>8);	// set up data on bus
	Nop();
	SET_CS;       // deselect chip
	Nop();
	CLR_CS;   // chip selected
	Nop();

	envia = WriteSPI1(data);	// set up data on bus
	Nop();
	SET_CS;       // deselect chip
}
//----------------------------------------------------------------

//Inicialização do display
//----------------------------------------------------------------
void initialization(void)
{
	unsigned int ulCount;
	Nop();
	SET_RD;
	Nop();
	SET_WR;
	Nop();
	SET_CS;
	Nop();
	SET_CD;
	Nop();

	CLR_RESET;
	delay(20000000); //200
	SET_RESET;
	delay(50000000); //500

	write_command(0x28);    // VCOM OTP
	write_data(0x0006);       // Page 55-56 of SSD2119 datasheet
	write_command(0x00);    // start Oscillator
	write_data(0x0001);       // Page 36 of SSD2119 datasheet
	write_command(0x10);    // Sleep mode
	write_data(0x0000);       // Page 49 of SSD2119 datasheet
	write_command(0x01);    // Driver Output Control
	write_data(0x72EF);       // Page 36-39 of SSD2119 datasheet
	write_command(0x02);    // LCD Driving Waveform Control
	write_data(0x0600);       // Page 40-42 of SSD2119 datasheet
	write_command(0x03);    // Power Control 1
	write_data(0x6A38);       // Page 43-44 of SSD2119 datasheet
	write_command(0x11);    // Entry Mode
	write_data(0x6870);//6874       // Page 50-52 of SSD2119 datasheet
	write_command(0x0F);    // Gate Scan Position
	write_data(0x0000);       // Page 49 of SSD2119 datasheet
	write_command(0x0B);    // Frame Cycle Control
	write_data(0x5308);       // Page 45 of SSD2119 datasheet
	write_command(0x0C);    // Power Control 2
	write_data(0x0003);       // Page 47 of SSD2119 datasheet
	write_command(0x0D);    // Power Control 3
	write_data(0x000A);       // Page 48 of SSD2119 datasheet
	write_command(0x0E);    // Power Control 4
	write_data(0x2E00);       // Page 48 of SSD2119 datasheet
	write_command(0x1E);    // Power Control 5
	write_data(0x00BE);       // Page 53 of SSD2119 datasheet
	write_command(0x25);    // Frame Frequency Control
	write_data(0x8000);       // Page 53 of SSD2119 datasheet
	write_command(0x26);    // Analog setting
	write_data(0x7800);       // Page 54 of SSD2119 datasheet
	
	 write_command(0x27);
 	 write_data(0x0078);

	write_command(0x4E);    // Ram Address Set
	write_data(0x0000);       // Page 58 of SSD2119 datasheet
	write_command(0x4F);    // Ram Address Set
	write_data(0x0000);       // Page 58 of SSD2119 datasheet
	write_command(0x12);    // Sleep mode
	write_data(0x08D9);       // Page 49 of SSD2119 datasheet
	// Gamma Control (R30h to R3Bh) -- Page 56 of SSD2119 datasheet
	write_command(0x30);
	write_data(0x0000);
	write_command(0x31);
	write_data(0x0104);
	write_command(0x32);
	write_data(0x0100);
	write_command(0x33);
	write_data(0x0305);
	write_command(0x34);
	write_data(0x0505);
	write_command(0x35);
	write_data(0x0305);
	write_command(0x36);
	write_data(0x0707);
	write_command(0x37);
	write_data(0x0300);
	write_command(0x3A);
	write_data(0x1200);
	write_command(0x3B);
	write_data(0x0800);		 
	write_command(0x07);    // Display Control 
	write_data(0x0033);       // Page 45 of SSD2119 datasheet
	delay(500); //150
	write_command(0x22);    // RAM data write/read
}

//Posiciona o display no primeiro ponto
//----------------------------------------------------------------
void Display_Home(void)
{
	write_command(0x4E);    // RAM address set
	write_data(0x0000);       // Page 58 of SSD2119 datasheet
	write_command(0x4F);    // RAM address set
	write_data(0x0000);       // Page 58 of SSD2119 datasheet
	write_command(0x44);    // Vertical RAM address position
	write_data(0xEF00);       // Page 57 of SSD2119 datasheet
	write_command(0x45);    // Horizontal RAM address position 
	write_data(0x0000);       // Page 57 of SSD2119 datasheet
	write_command(0x46);    // Horizontal RAM address position
	write_data(0x013F);       // Page 57 of SSD2119 datasheet
	write_command(0x22);    // RAM data write/read
}
//----------------------------------------------------------------

//Coloca todo o display numa determinada cor
//----------------------------------------------------------------
void display_rgb(unsigned int data)
{
	unsigned int i,j;
	Display_Home();
	for(i=0;i<320;i++)
  {
  	for(j=0;j<240;j++)
  	{
  		write_data(data);
  	}
  }
}
//----------------------------------------------------------------
Graciously,
Alex Marques
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

djautoclinic

New member
Are you supplying power to the backlight LED connections. I see V_Display at the LCD but no power supply circuit for the power. Without the backlight the display will stay black and you could be writing data but are not able to see it. I apologize if you are aware of this but some may not know the backlight is needed to really see anything at all on this display.
 

alexmarques

New member
Food yes, and the screen gets all branca.Eu food with a switching power supply
which increases the voltage to 9v 3v3. Thanks for responding.
 
Top