BGB320240-5a graphic display not working

cog

New member
I'm using BGB320240-5a display with Raio8835p3n interfaced with dspic30f4011.
I've initialized display in graphics mode, but what I can see are vertical lines only.
Here is the code,

Code:
void GLCD_w_cmd(unsigned char cmd)
{
	DATA = cmd;
		A0   = 1 ;	
	WRD  = 0 ;	
	CS   = 0 ;
	delay_ms(10);
		WRD  = 1 ;
	CS   = 1 ;
	//A0   = 0 ;
	//delay_ms(10);
}

void GLCD_w_data(unsigned char data)
{
	DATA = data;
	A0   = 0 ;
	WRD  = 0 ;
//RED =1;
	CS   = 0 ;
	delay_ms(10);
	WRD  = 1 ;
	CS   = 1 ;	
//	A0   = 1 ;
//	delay_ms(10);
}
void HD_init()
{
	delay_ms(50);
//	CS = 0;
	 ADPCFG = 0xFFFF;
	TRISB = 0x0000;
	TRISE = 0x0000;
	TRISD = 0x00;
		RED =1;
	//	CS = 0;
	delay_ms(50);
	//RST=0;				//display off
	delay_ms(50);delay_ms(50);
	RST=1;				//display on
	delay_ms(50);delay_ms(50);
}


void GLCD_init()
{
	GLCD_w_cmd(0x40);					//		MOV	A,#40H		;System	Initialize,With	8 Parameter
											//		CALL	W_CMD
	GLCD_w_data(0x30);						//		MOV	A,#30H		;Interal CGROM+CGRAM1, 8x8 Font
											//		CALL	W_DAT		;Single-Panel
	GLCD_w_data(0x87);										//		MOV	A,#87H		;8 Pixels Width
											//		CALL	W_DAT
	GLCD_w_data(0x07);										//		MOV	A,#07H		;8 Pixels Height
											//		CALL	W_DAT
	GLCD_w_data(0x27);										//		MOV	A,#27H		;Max Byte Number Of 1 Line:C/R=320/8-1=27H
											//		CALL	W_DAT
	GLCD_w_data(0x41);										//		MOV	A,#41H		;TC/R:Length,Including Horizontal Blanking,Of One Screen Line
											//		CALL	W_DAT		;17H=C/R+4<=TC/R<=76H
	GLCD_w_data(0xf0);										//		MOV	A,#0F0H		;Number	Of Lines:240-1=0F0H
											//		CALL	W_DAT
	GLCD_w_data(0x28);								//		MOV	A,#28H		;Width Of Display Line(Low Byte):320/8=40=28H
										//		CALL	W_DAT							//		MOV	A,#00H		;Width Of Display Line(High Byte)
										//		CALL	W_DAT
	GLCD_w_data(0x00);//1
											//;--------------------------------------
	
	GLCD_w_cmd(0x44);											//		MOV	A,#44H		;Scroll	Command,With 10	Parameter
											//		CALL	W_CMD
	GLCD_w_data(0x00);										//		MOV	A,#00H		;Area 1	Start Address(Low Byte):00H
	
	GLCD_w_data(0x00);
										//		CALL	W_DAT
											//		MOV	A,#00H		;Area 1	Start Address(High Byte):00H
											//		CALL	W_DAT
	GLCD_w_data(0x0F0);										//		MOV	A,#0F0H		;Area 1	Display	Lines:240=0A0H
											//		CALL	W_DAT
	GLCD_w_data(0x00);										//		MOV	A,#00H		;Area 2	Start Address(Low Byte)
											//		CALL	W_DAT		;160 Lines X 20	Chars=3200=0C800H
	GLCD_w_data(0x00);										//		MOV	A,#00H		;Area 2	Start Address(High Byte)
											//		CALL	W_DAT
	GLCD_w_data(0xf0);										//		MOV	A,#0F0H		;Area 2	Display	Lines:160=0A0H
											//		CALL	W_DAT
	GLCD_w_data(0x00);										//		MOV	A,#00H		;Area 3	Start Address(Low Byte)
											//		CALL	W_DAT		;0C80*2	=1900H
	GLCD_w_data(0x00);										//		MOV	A,#00H		;Area 3	Start Address(High Byte)
											//		CALL	W_DAT
	GLCD_w_data(0x00);										//		MOV	A,#00H		;Area 4	Low Byte(Invalid)
											//		CALL	W_DAT
	GLCD_w_data(0x00);										//		MOV	A,#00H		;Area 4	High Byte(Invalid)
		//GLCD_w_data(0x00);												//		CALL	W_DAT
//	GLCD_w_data(0x00);
//		GLCD_w_data(0x00);	
			GLCD_w_cmd(0x5a);	
					GLCD_w_data(0x00);
		//GLCD_w_data(0x87);											//;--------------------------------------
//	GLCD_w_cmd(0x5A);										//		MOV	A,#5AH		;Horizontal Scroll Position
											//		CALL	W_CMD
//	GLCD_w_data(0x00);										//		MOV	A,#00H
											//		CALL	W_DAT
											//;--------------------------------------
	GLCD_w_cmd(0x5B);										//	;	MOV	A,#5BH		;Define	Screen Overlay Info
											//	;	CALL	W_CMD
	GLCD_w_data(0x0c);
											//	;	MOV	A,#0CH		;XOR Mode,Two-layer composition
	GLCD_w_cmd(0x5d);
	GLCD_w_data(0x07);										//	;	CALL	W_DAT		;Graphics mode
		GLCD_w_data(0x01);
		GLCD_w_cmd(0x4c);
							//		CALL	W_DAT
											//;--------------------------------------
											//		MOV	A,#4CH		;Set Cursor Direction:Right
											//		CALL	W_CMD
											//;--------------------------------------
	GLCD_w_cmd(0x59);
	GLCD_w_data(0x04);										//		MOV	A,#04H
													//CALL	W_DAT		
}

void ADS_init()
{											//Initialize Display Address And Write Mode
	int i;								//;-----------------------------------------
	GLCD_w_cmd(0x5B);						//INIT_ADS:	MOV	A,#5BH		;Define	Screen Overlay Info
											//		CALL	W_CMD
	GLCD_w_data(0x0c);						//		MOV	A,#0CH		;XOR Mode,Two-layer composition
											//		CALL	W_DAT		;Graphics mode
	GLCD_w_cmd(0x46);						//      MOV	A,#46H		;Set Cursor Address
											//		LCALL	W_CMD
	GLCD_w_data(0x00);						//		MOV	A,#00H
											//		LCALL	W_DAT
	GLCD_w_data(0x00);						//		MOV	A,#00H
											//		LCALL	W_DAT
	GLCD_w_cmd(0x42);
	
}  
void ClearAll(void)
{
	unsigned int i, j;
	ADS_init();
	for( i = 0; i < 240; i++)
	{
		for( j = 0; j < 40; j++ )
		{
			GLCD_w_data(0);
			//	delay_ms(10);
		}
		
	}
		delay_ms(100);
}
void DisplayAll(void)
{
	int i, j;
	ADS_init();
	for( i = 0; i < 240; i++)
	{
		for( j = 0; j < 40; j++ )
		{
			GLCD_w_data(0xcc);
			//	delay_ms(10);
		}
		
	}
	
		delay_ms(100);
}
Graphic_LCD.jpg Graphic_LCD.jpg
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 
Is this a Crystalfontz product? I don't see any part number starting with "BGB", nor any with a Raio8835 controller.

My impression of your photos is that the display contrast is not set properly.
 

cog

New member
Thanks cosmicvoid,

It's a Balze display 320x240, In datasheet nowhere mentioned about what should be the contrast voltage.
pinout are as below,

Pin Symbol Level Function
1 VSS 0V POWER GROUND
2 VDD 5V POWER SUPPLY
3 VO FOR LCD VOLTAGE
4 WR H/L WRITE SIGNAL
5 RD H/L READ SIGNAL
6 CS H/L CHIP SELECT
7 A0 H/L H: DATA L: Instruction
8 RST H/L reset
9 DB0 H/L Data bus
10 DB1 H/L Data bus
11 DB2 H/L Data bus
12 DB3 H/L Data bus
13 DB4 H/L Data bus
14 DB5 H/L Data bus
15 DB6 H/L Data bus
16 DB7 H/L Data bus
17 NC
18 VEE - 23V
19 LEDA 5V
20 LEDK 0V
 
The usual contrast circuit is a 10Kohm pot, one outer terminal connected to VDD (pin 2) and the other outer terminal to VEE (pin 18). The center terminal connects to Vo (pin 3).

VEE is the output of the internal DC-DC converter, for LCD bias voltage.
 
Top