Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem regarding interfacing of TFT colour display 320x240 with STM32 ARM controller

Status
Not open for further replies.

Deepak Rathore

Member level 2
Member level 2
Joined
Apr 25, 2012
Messages
46
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,659
hello frineds

currently i have bought the ARM cortex-m3 STM32 board from Mikroelectronika which have the TFT colour display of 320x240.
The display have LCD controller of SSD2119 and LCD module(MI0283QT2).

my goal is to write the routine code of interfacing of TFT display with ARM. but i really don't know the how to intialize the TFT display.
what commands needed to intialize the TFT LCD and write data(images) to LCD.

i had read the SSD2119 datasheet.i havn't got anything .please help me if anyone such is using that interfacing.
 

Hello,
Try this initialization sequence, I found in a code example (but I do not test it).

Code:
       void SSD2119_Init(void)      //SSD2119 (DeviceCode==0x9919)
	{
		//*********POWER ON &RESET DISPLAY OFF
		 LCD_WriteReg(0x28,0x0006);
		 LCD_WriteReg(0x00,0x0001);
		 LCD_WriteReg(0x10,0x0000);
		 LCD_WriteReg(0x01,0x72ef);
		 LCD_WriteReg(0x02,0x0600);
		 LCD_WriteReg(0x03,0x6a38);
		 LCD_WriteReg(0x11,0x6874);//70
		
	               //  RAM WRITE DATA MASK
		 LCD_WriteReg(0x0f,0x0000); 
		 //  RAM WRITE DATA MASK
		 LCD_WriteReg(0x0b,0x5308); 
		 LCD_WriteReg(0x0c,0x0003);
		 LCD_WriteReg(0x0d,0x000a);
		 LCD_WriteReg(0x0e,0x2e00);  //0030
		 LCD_WriteReg(0x1e,0x00be);
		 LCD_WriteReg(0x25,0x8000);
		 LCD_WriteReg(0x26,0x7800);
		 LCD_WriteReg(0x27,0x0078);
		 LCD_WriteReg(0x4e,0x0000);
		 LCD_WriteReg(0x4f,0x0000);
		 LCD_WriteReg(0x12,0x08d9);
		
		 // -----------------Adjust the Gamma Curve----//
		 LCD_WriteReg(0x30,0x0000);	 //0007
		 LCD_WriteReg(0x31,0x0104);	   //0203
		 LCD_WriteReg(0x32,0x0100);		//0001
		 LCD_WriteReg(0x33,0x0305);	  //0007
		 LCD_WriteReg(0x34,0x0505);	  //0007
		 LCD_WriteReg(0x35,0x0305);		 //0407
		 LCD_WriteReg(0x36,0x0707);		 //0407
		 LCD_WriteReg(0x37,0x0300);		  //0607
		 LCD_WriteReg(0x3a,0x1200);		 //0106
		 LCD_WriteReg(0x3b,0x0800);		 
		 LCD_WriteReg(0x07,0x0033);
	}

I hope this is usefull for you.
 

Thanks alex_r for your reply,

i had interfaced TFT display with ARM, fill with different colours.it is working.
but i am not able to clear the My TFT display.
what is commands needed to clear the TFT display.when i clear LCD and write or draw something like rectangle on it,then it is not appeared on it.if you have any idea ,then plz reply.

Deepak
 

Hello,

First you wrote:
i had interfaced TFT display with ARM, fill with different colours.it is working.

Same code that you use to fill perform clear! Do not exist any specific command. Simple use your background color-
When you try to draw a rectangle, windows register have correct setting ?

If you need more help, please include some code in next reply.
 

Hello,

First you wrote:


Same code that you use to fill perform clear! Do not exist any specific command. Simple use your background color-
When you try to draw a rectangle, windows register have correct setting ?

If you need more help, please include some code in next reply.

thanx alex for ur reply...

to clear the LCD, i just fill the LCD with White color.but after filling white color, i draw the rectangle,but it is not appeared on the TFT LCD.

my code is here to fill the LCD
int main()
{
LCD_fill(0,0,319,239,Black);
delay_ms(1000);
Square_draw(100,100,200,200,red);
}

void LCD_fill(unsigned char Xmin,unsigned char Ymin,unsigned char Xmax,unsigned char Ymax,unsigned int color)
{

unsigned char z,i;
LCD_win(Xmin,Ymin.Ymax,Ymax);

z = ((Xmax - (Xmin+1)) *(Ymax-(Ymin+1)));
for(i=z;i>=0;i--)
{
GPIO_PORTJ_DATA_R = COLOR/0X100;
TFT_WR = 0;
TFT_WR = 1;

GPIO_PORTJ_DATA_R = COLOR%0X100;
TFT_WR = 0;
TFT_WR = 1;
}
}
 

I suggest to declare as unsigned short at least Xmin,Xmax and as long z,i (Your compiler do not give some warning?)
The correct number of data to fill is:

Code:
z = ((Xmax +1) - Xmin) *((Ymax+1)-Ymin)); 
for(i=z;i!=0;i--)
.....

You missing Square_draw() code.

Also I view that you have a TFT 8bit bus. Check if all write in other code have 2 cycle.
 
Last edited:
hey alex_r
thank you very much for ur reply.
it is really working.
now it is possible to draw rectangle or fill any color to LCD after clear the TFT LCD.

now i am going to display the text and strings on the LCD.
i havn't any idea to display text on LCD display

if u hav any idea to display text to TFT LCD,then plz suggest me.

With Regards.
Deepak
 

Hello,

To display text you need a character bitmap table and a function to draw it.
You can use this code for a ascii font 8x16 pixel:
Code:
const unsigned char ascii_8x16[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,
0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x6C,0x6C,0xFE,0x6C,0x6C,0x6C,0xFE,0x6C,0x6C,0x00,0x00,0x00,0x00,
0x18,0x18,0x7C,0xC6,0xC2,0xC0,0x7C,0x06,0x86,0xC6,0x7C,0x18,0x18,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xC2,0xC6,0x0C,0x18,0x30,0x60,0xC6,0x86,0x00,0x00,0x00,0x00,
0x00,0x00,0x38,0x6C,0x6C,0x38,0x76,0xDC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,
0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x0C,0x18,0x30,0x30,0x30,0x30,0x30,0x30,0x18,0x0C,0x00,0x00,0x00,0x00,
0x00,0x00,0x30,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x30,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x06,0x0C,0x18,0x30,0x60,0xC0,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x7C,0xC6,0xC6,0xCE,0xD6,0xD6,0xE6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00,
0x00,0x00,0x7C,0xC6,0x06,0x0C,0x18,0x30,0x60,0xC0,0xC6,0xFE,0x00,0x00,0x00,0x00,
0x00,0x00,0x7C,0xC6,0x06,0x06,0x3C,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00,
0x00,0x00,0x0C,0x1C,0x3C,0x6C,0xCC,0xFE,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00,
0x00,0x00,0xFE,0xC0,0xC0,0xC0,0xFC,0x0E,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00,
0x00,0x00,0x38,0x60,0xC0,0xC0,0xFC,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
0x00,0x00,0xFE,0xC6,0x06,0x06,0x0C,0x18,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00,
0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7C,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7E,0x06,0x06,0x06,0x0C,0x78,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x60,0x00,0x00,0x00,0x00,
0x00,0x00,0x7C,0xC6,0xC6,0x0C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x7C,0xC6,0xC6,0xDE,0xDE,0xDE,0xDC,0xC0,0x7C,0x00,0x00,0x00,0x00,
0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00,
0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x66,0x66,0x66,0x66,0xFC,0x00,0x00,0x00,0x00,
0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xC0,0xC2,0x66,0x3C,0x00,0x00,0x00,0x00,
0x00,0x00,0xF8,0x6C,0x66,0x66,0x66,0x66,0x66,0x66,0x6C,0xF8,0x00,0x00,0x00,0x00,
0x00,0x00,0xFE,0x66,0x62,0x68,0x78,0x68,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00,
0x00,0x00,0xFE,0x66,0x62,0x68,0x78,0x68,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00,
0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xDE,0xC6,0xC6,0x66,0x3A,0x00,0x00,0x00,0x00,
0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00,
0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
0x00,0x00,0x1E,0x0C,0x0C,0x0C,0x0C,0x0C,0xCC,0xCC,0xCC,0x78,0x00,0x00,0x00,0x00,
0x00,0x00,0xE6,0x66,0x6C,0x6C,0x78,0x78,0x6C,0x66,0x66,0xE6,0x00,0x00,0x00,0x00,
0x00,0x00,0xF0,0x60,0x60,0x60,0x60,0x60,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00,
0x00,0x00,0xC6,0xEE,0xFE,0xFE,0xD6,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00,
0x00,0x00,0xC6,0xE6,0xF6,0xFE,0xDE,0xCE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00,
0x00,0x00,0x38,0x6C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x6C,0x38,0x00,0x00,0x00,0x00,
0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00,
0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xD6,0xDE,0x7C,0x0C,0x0E,0x00,0x00,
0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x6C,0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00,
0x00,0x00,0x7C,0xC6,0xC6,0x60,0x38,0x0C,0x06,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
0x00,0x00,0x7E,0x7E,0x5A,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x6C,0x38,0x10,0x00,0x00,0x00,0x00,
0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xD6,0xD6,0xFE,0x6C,0x6C,0x00,0x00,0x00,0x00,
0x00,0x00,0xC6,0xC6,0x6C,0x6C,0x38,0x38,0x6C,0x6C,0xC6,0xC6,0x00,0x00,0x00,0x00,
0x00,0x00,0x66,0x66,0x66,0x66,0x3C,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
0x00,0x00,0xFE,0xC6,0x86,0x0C,0x18,0x30,0x60,0xC2,0xC6,0xFE,0x00,0x00,0x00,0x00,
0x00,0x00,0x3C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0xC0,0xE0,0x70,0x38,0x1C,0x0E,0x06,0x02,0x00,0x00,0x00,0x00,
0x00,0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00,0x00,0x00,0x00,
0x10,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,
0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,
0x00,0x00,0xE0,0x60,0x60,0x78,0x6C,0x66,0x66,0x66,0x66,0xDC,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC0,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00,
0x00,0x00,0x1C,0x0C,0x0C,0x3C,0x6C,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00,
0x00,0x00,0x38,0x6C,0x64,0x60,0xF0,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x76,0xCC,0xCC,0xCC,0xCC,0xCC,0x7C,0x0C,0xCC,0x78,0x00,
0x00,0x00,0xE0,0x60,0x60,0x6C,0x76,0x66,0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00,
0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
0x00,0x00,0x06,0x06,0x00,0x0E,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00,
0x00,0x00,0xE0,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0xE6,0x00,0x00,0x00,0x00,
0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xEC,0xFE,0xD6,0xD6,0xD6,0xD6,0xD6,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00,
0x00,0x00,0x00,0x00,0x00,0x76,0xCC,0xCC,0xCC,0xCC,0xCC,0x7C,0x0C,0x0C,0x1E,0x00,
0x00,0x00,0x00,0x00,0x00,0xDC,0x76,0x62,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0x60,0x38,0x0C,0xC6,0x7C,0x00,0x00,0x00,0x00,
0x00,0x00,0x10,0x30,0x30,0xFC,0x30,0x30,0x30,0x30,0x36,0x1C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x3C,0x18,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0xD6,0xD6,0xFE,0x6C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xC6,0x6C,0x38,0x38,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0xF8,0x00,
0x00,0x00,0x00,0x00,0x00,0xFE,0xCC,0x18,0x30,0x60,0xC6,0xFE,0x00,0x00,0x00,0x00,
0x00,0x00,0x0E,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0E,0x00,0x00,0x00,0x00,
0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
0x00,0x00,0x70,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00,
0x00,0x00,0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0x00,0x00,0x00,0x00,0x00};

//*******************************************************************************
// Function Name  : LCD_PutChar
// Description    : Draw a 8*16 char using CH_COLOR over BK_COLOR 
// Input          : - Xs,Ys: specifies the X/Y start position 
//                : - chr:  the character to draw   
//*******************************************************************************
void LCD_PutChar( unsigned short Xs,        // X start point
                  unsigned char  Ys,        // Y start point
                  unsigned char  chr,       // ascii code (0x20-0x7f)
                  unsigned short CH_COLOR,  // character color
                  unsigned short BK_COLOR)  // background color
{
  unsigned char y,tmp_ch,tmp_xb,ch=chr;

  LCD_win(Xs,Ys,Xs+7,Ys+15);

  if ((chr < 0x20) | (chr > 0x7f))
     ch=0x20; 
		

  for (y=0;y<16;y++)
  {
    tmp_ch=ascii_8x16[((ch-0x20)*16)+y];
    tmp_xb=0x80;
    do
    {
      if (tmp_ch & tmp_xb) 
      {
        GPIO_PORTJ_DATA_R = CH_COLOR>>8;
        TFT_WR = 0;
        TFT_WR = 1;

        GPIO_PORTJ_DATA_R = CH_COLOR & 0xff;
        TFT_WR = 0;
        TFT_WR = 1;
      }
      else
      {
        GPIO_PORTJ_DATA_R = BK_COLOR>>8;
        TFT_WR = 0;
        TFT_WR = 1;

        GPIO_PORTJ_DATA_R = BK_COLOR & 0xff;
        TFT_WR = 0;
        TFT_WR = 1;
      }
    }while (tmp_xb>>=1);
  }
}



//*******************************************************************************
// Function Name  : LCD_PutString
// Description    : Draw a 8*16 char string using using CH_COLOR over BK_COLOR 
// Input          : - Xs,Ys: specifies the X/Y start position 
//                : - *ptr:  the character string to draw   
//*******************************************************************************
void LCD_PutString(unsigned short Xs,
                   unsigned char  Ys,
                   unsigned char *ptr,
                   unsigned short CH_COLOR,  // character color
                   unsigned short BK_COLOR)  // background color

{
  unsigned short cur_x=Xs;

  while ((*ptr != 0) & (cur_x < 312))
  {
    LCD_PutChar(cur_x,Ys,*ptr,CH_COLOR,BK_COLOR);
    cur_x += 8;
    ptr++;
  }
}

example of usage:
Code:
LCD_PutChar(100,100,'a',0xffff,0x0000);     // display char in 100,100 white over black
LCD_PutChar(10,10,"Hello !",0x0000,0xffff); // display string in 10,10 black over white

Regards.
 
Last edited:

thanks alex_r for your reply
i have already displayed the character and the strings to the TFT LCD before ur reply.

but ur code is really working and it is really helpful.

hey alex_r my 2dy task is to display the color images on the TFT Display.
and i have already downloaded the bitmap converter soft(to convert the color image data to pixel array).

i have pixel array data but i really don't know how can i sent to the LCD. i tried lot's times in my code but it is nt wrking.
pls if u have any idea then suggest me. i wait for your reply.


with regards
Deepak Rathore
 

Hello,
It is the same that when you fill, but you must change the 'COLOR' with a pixel color.

Code:
.....
.....

        COLOR=My_BMP[x][y];
        
        GPIO_PORTJ_DATA_R = COLOR>>8;
        TFT_WR = 0;
        TFT_WR = 1;

        GPIO_PORTJ_DATA_R = COLOR & 0xff;
        TFT_WR = 0;
        TFT_WR = 1;
.....
.....
 

Hello,
It is the same that when you fill, but you must change the 'COLOR' with a pixel color.

Code:
.....
.....

        COLOR=My_BMP[x][y];
        
        GPIO_PORTJ_DATA_R = COLOR>>8;
        TFT_WR = 0;
        TFT_WR = 1;

        GPIO_PORTJ_DATA_R = COLOR & 0xff;
        TFT_WR = 0;
        TFT_WR = 1;
.....
.....

hi alex_r, here is my BMP file format which is as follows.



Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#define image_width (50)
#define image_height (50)
 
 
unsigned char bitmap[]= 
{
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
};
 
in this whole array,there is only 8 bit data. if i shift the data right 8 times,then the pixel array element will be same which is as follows.
       GPIO_PORTJ_DATA_R = COLOR>>8;
        TFT_WR = 0;
        TFT_WR = 1;
and then I and my color data with 0xFF,then it will be also same. my code is as follows.
 
 
void drawPicture(void)
{
    unsigned int i,j;
    unsigned int val=0;
    LCD_win(0,0,50,50)
    LCD_Cmd(0x22);
    CS = 0;
    
    for(i=0;i<40;i++)
    {
        for(j=0;j<50;j++)
        {
           GPIO_PORTJ_DATA_R = bitmap[val];
        WR = 0;
        WR = 1;
        val++;
 
        GPIO_PORTJ_DATA_R = bitmap[val];
        WR = 0;
        WR = 1;
 
        val++;
        }
}
    CS = 1;
}



plz suggest me where i am doing mistake......
 
Last edited by a moderator:

Try this:
Code:
for(i=0;i<40;i++)
{
   for(j=0;j<25;j++)
   {
   ...
   ...
enjoy !
 

hey alex_r i have already tried at that way....

if i hve my pixel width and height is 320x240,then i tried in this way

char bmp[77800] = { 0XFF,0XFE,...........here my pic pixel array values....}

for(i=0;i<320;i++)
{
for(j=0;j<240;j++)
{
GPIO_PORTJ_DATA_R = bmp[val]/0x10;
WR =0;
WR =1;
GPIO_PORTJ_DATA_R = bmp[val]%0x10;
WR =0;
WR =1;
val++;
}
}

in this way i can't get my image file. display filled with differnt colors but nt the image file

is there any other way to send pixel info to the LCD.?????????????
with the pixel converter soft. i get the sigle dimensional array.is that right...
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top