Freaduino ADK + Android + LCD, Dual Screen Display
January 4, 2019Easy GPS Unit – Fastrax UP501 Receiver Module
January 4, 2019TFT01 series LCD modules there are 3 kind of sizes. They are 2.4″(RGB 320 x 240), 3.2″(RGB 320 x 240???/strong>and 3.2w”(RGB 400 x 240). Each of it has separate drive controller. We conclude that each of the drive, for user-friendly reference. 2.4″(RGB 320 x 240), used a controller ILI9325, it’s a support 8/16bit data interface , easy to drive by many MCU like STM32 ,AVR and 8051. Note the Address_set() function is different each other, which setting X/Y coordinates. The initial function as follows:
[cce_cpp] void Address_set(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2) { Lcd_Write_Com(0x00,0x20); Lcd_Write_Data(x1>>8,x1); //Setting X Lcd_Write_Com(0x00,0x21); Lcd_Write_Data(y1>>8,y1); //Setting Y Lcd_Write_Com(0x00,0x50); Lcd_Write_Data(x1>>8,x1); //start X Lcd_Write_Com(0x00,0x52); Lcd_Write_Data(y1>>8,y1); //start Y Lcd_Write_Com(0x00,0x51); Lcd_Write_Data(x2>>8,x2); //end X Lcd_Write_Com(0x00,0x53); Lcd_Write_Data(y2>>8,y2); //end Y Lcd_Write_Com(0x00,0x22); } void Lcd_Init(void) { digitalWrite(LCD_REST,HIGH); delay(5); digitalWrite(LCD_REST,LOW); delay(15); digitalWrite(LCD_REST,HIGH); delay(15); digitalWrite(LCD_CS,LOW); Lcd_Write_Com_Data(0x0001, 0x0100); // set SS and SM bit Lcd_Write_Com_Data(0x0002, 0x0200); // set 1 line inversion Lcd_Write_Com_Data(0x0003, 0x1030); // set GRAM write direction and BGR=1. Lcd_Write_Com_Data(0x0004, 0x0000); // Resize register Lcd_Write_Com_Data(0x0008, 0x0207); // set the back porch and front porch Lcd_Write_Com_Data(0x0009, 0x0000); // set non-display area refresh cycle ISC[3:0] Lcd_Write_Com_Data(0x000A, 0x0000); // FMARK function Lcd_Write_Com_Data(0x000C, 0x0000); // RGB interface setting Lcd_Write_Com_Data(0x000D, 0x0000); // Frame marker Position Lcd_Write_Com_Data(0x000F, 0x0000); // RGB interface polarity //*************Power On sequence ****************// Lcd_Write_Com_Data(0x0010, 0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB Lcd_Write_Com_Data(0x0011, 0x0007); // DC1[2:0], DC0[2:0], VC[2:0] Lcd_Write_Com_Data(0x0012, 0x0000); // VREG1OUT voltage Lcd_Write_Com_Data(0x0013, 0x0000); // VDV[4:0] for VCOM amplitude Lcd_Write_Com_Data(0x0007, 0x0001); delay(200); // Dis-charge capacitor power voltage Lcd_Write_Com_Data(0x0010, 0x1690); // SAP, BT[3:0], AP, DSTB, SLP, STB Lcd_Write_Com_Data(0x0011, 0x0227); // Set DC1[2:0], DC0[2:0], VC[2:0] delay(50); // Delay 50ms Lcd_Write_Com_Data(0x0012, 0x000D); // 0012 delay(50); // Delay 50ms Lcd_Write_Com_Data(0x0013, 0x1200); // VDV[4:0] for VCOM amplitude Lcd_Write_Com_Data(0x0029, 0x000A); // 04 VCM[5:0] for VCOMH Lcd_Write_Com_Data(0x002B, 0x000D); // Set Frame Rate delay(50); // Delay 50ms Lcd_Write_Com_Data(0x0020, 0x0000); // GRAM horizontal Address Lcd_Write_Com_Data(0x0021, 0x0000); // GRAM Vertical Address // ----------- Adjust the Gamma Curve ----------// Lcd_Write_Com_Data(0x0030, 0x0000); Lcd_Write_Com_Data(0x0031, 0x0404); Lcd_Write_Com_Data(0x0032, 0x0003); Lcd_Write_Com_Data(0x0035, 0x0405); Lcd_Write_Com_Data(0x0036, 0x0808); Lcd_Write_Com_Data(0x0037, 0x0407); Lcd_Write_Com_Data(0x0038, 0x0303); Lcd_Write_Com_Data(0x0039, 0x0707); Lcd_Write_Com_Data(0x003C, 0x0504); Lcd_Write_Com_Data(0x003D, 0x0808); //------------------ Set GRAM area ---------------// Lcd_Write_Com_Data(0x0050, 0x0000); // Horizontal GRAM Start Address Lcd_Write_Com_Data(0x0051, 0x00EF); // Horizontal GRAM End Address Lcd_Write_Com_Data(0x0052, 0x0000); // Vertical GRAM Start Address Lcd_Write_Com_Data(0x0053, 0x013F); // Vertical GRAM Start Address Lcd_Write_Com_Data(0x0060, 0xA700); // Gate Scan Line Lcd_Write_Com_Data(0x0061, 0x0001); // NDL,VLE, REV Lcd_Write_Com_Data(0x006A, 0x0000); // set scrolling line //-------------- Partial Display Control ---------// Lcd_Write_Com_Data(0x0080, 0x0000); Lcd_Write_Com_Data(0x0081, 0x0000); Lcd_Write_Com_Data(0x0082, 0x0000); Lcd_Write_Com_Data(0x0083, 0x0000); Lcd_Write_Com_Data(0x0084, 0x0000); Lcd_Write_Com_Data(0x0085, 0x0000); //-------------- Panel Control -------------------// Lcd_Write_Com_Data(0x0090, 0x0010); Lcd_Write_Com_Data(0x0092, 0x0000); Lcd_Write_Com_Data(0x0007, 0x0133); // 262K color and display ON digitalWrite(LCD_CS,HIGH); } [/cce_cpp]
3.2″RGB 320 x 240??? a controller SSD1289, it’s a support 16bit data interface , easy to drive by many MCU like STM32 ,AVR and 8051. Note the Address_set() function is different each other, which setting X/Y coordinates. The initial function as follows:
[cce_cpp] void Address_set(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2) { Lcd_Write_Com_Data(0x0044,(x2<<8)+x1); Lcd_Write_Com_Data(0x0045,y1); Lcd_Write_Com_Data(0x0046,y2); Lcd_Write_Com_Data(0x004e,x1); Lcd_Write_Com_Data(0x004f,y1); Lcd_Write_Com(0x00,0x22); } void Lcd_Init(void) { digitalWrite(LCD_REST,HIGH); delay(5); digitalWrite(LCD_REST,LOW); delay(15); digitalWrite(LCD_REST,HIGH); delay(15); Lcd_Write_Com_Data(0x0000,0x0001); delay(1); //Open Crystal Lcd_Write_Com_Data(0x0003,0xA8A4); delay(1); //0xA8A4 Lcd_Write_Com_Data(0x000C,0x0000); delay(1); Lcd_Write_Com_Data(0x000D,0x080C); delay(1); Lcd_Write_Com_Data(0x000E,0x2B00); delay(1); Lcd_Write_Com_Data(0x001E,0x00B7); delay(1); Lcd_Write_Com_Data(0x0001,0x2B3F); delay(1); //320*240 0x6B3F Lcd_Write_Com_Data(0x0002,0x0600); delay(1); Lcd_Write_Com_Data(0x0010,0x0000); delay(1); Lcd_Write_Com_Data(0x0011,0x6070); delay(1); //0x4030 Lcd_Write_Com_Data(0x0005,0x0000); delay(1); Lcd_Write_Com_Data(0x0006,0x0000); delay(1); Lcd_Write_Com_Data(0x0016,0xEF1C); delay(1); Lcd_Write_Com_Data(0x0017,0x0003); delay(1); Lcd_Write_Com_Data(0x0007,0x0233); delay(1); //0x0233 Lcd_Write_Com_Data(0x000B,0x0000); delay(1); Lcd_Write_Com_Data(0x000F,0x0000); delay(1); //start address Lcd_Write_Com_Data(0x0041,0x0000); delay(1); Lcd_Write_Com_Data(0x0042,0x0000); delay(1); Lcd_Write_Com_Data(0x0048,0x0000); delay(1); Lcd_Write_Com_Data(0x0049,0x013F); delay(1); Lcd_Write_Com_Data(0x004A,0x0000); delay(1); Lcd_Write_Com_Data(0x004B,0x0000); delay(1); Lcd_Write_Com_Data(0x0044,0xEF00); delay(1); Lcd_Write_Com_Data(0x0045,0x0000); delay(1); Lcd_Write_Com_Data(0x0046,0x013F); delay(1); Lcd_Write_Com_Data(0x0030,0x0707); delay(1); Lcd_Write_Com_Data(0x0031,0x0204); delay(1); Lcd_Write_Com_Data(0x0032,0x0204); delay(1); Lcd_Write_Com_Data(0x0033,0x0502); delay(1); Lcd_Write_Com_Data(0x0034,0x0507); delay(1); Lcd_Write_Com_Data(0x0035,0x0204); delay(1); Lcd_Write_Com_Data(0x0036,0x0204); delay(1); Lcd_Write_Com_Data(0x0037,0x0502); delay(1); Lcd_Write_Com_Data(0x003A,0x0302); delay(1); Lcd_Write_Com_Data(0x003B,0x0302); delay(1); Lcd_Write_Com_Data(0x0023,0x0000); delay(1); Lcd_Write_Com_Data(0x0024,0x0000); delay(1); Lcd_Write_Com_Data(0x0025,0x8000); delay(1); Lcd_Write_Com_Data(0x004f,0); // Lcd_Write_Com_Data(0x004e,0); // Lcd_Write_Com(0x00,0x22); } [/cce_cpp]
3.2w”RGB 400 x 240??? a controller ILI9327, it’s a support 16bit data interface. The initial function as follows:
[cce_cpp] void Address_set(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2) { Lcd_Write_Com(0x00,0x2a); Lcd_Write_Data(0x00,x1>>8); //start X Lcd_Write_Data(0x00,x1); //start X Lcd_Write_Data(0x00,x2>>8); //end X Lcd_Write_Data(0x00,x2); //end X Lcd_Write_Com(0x00,0x2b); Lcd_Write_Data(0x00,y1>>8); //start Y Lcd_Write_Data(0x00,y1); //start Y Lcd_Write_Data(0x00,y2>>8); //end Y Lcd_Write_Data(0x00,y2); //end Y Lcd_Write_Com(0x00,0x2c); } void Lcd_Init(void) { digitalWrite(LCD_REST,HIGH); delay(5); digitalWrite(LCD_REST,LOW); delay(15); digitalWrite(LCD_REST,HIGH); delay(15); digitalWrite(LCD_CS,LOW); Lcd_Write_Com(0x00,0xE9); Lcd_Write_Data(0x00,0x20); Lcd_Write_Com(0x00,0x11); //Exit Sleep delay(100); Lcd_Write_Com(0x00,0xD1); Lcd_Write_Data(0x00,0x00); Lcd_Write_Data(0x00,0x71); Lcd_Write_Data(0x00,0x19); Lcd_Write_Com(0x00,0xD0); Lcd_Write_Data(0x00,0x07); Lcd_Write_Data(0x00,0x01); Lcd_Write_Data(0x00,0x08); Lcd_Write_Com(0x00,0x36); Lcd_Write_Data(0x00,0x48); Lcd_Write_Com(0x00,0x3A); Lcd_Write_Data(0x00,0x05); Lcd_Write_Com(0x00,0xC1); Lcd_Write_Data(0x00,0x10); Lcd_Write_Data(0x00,0x10); Lcd_Write_Data(0x00,0x02); Lcd_Write_Data(0x00,0x02); Lcd_Write_Com(0x00,0xC0); //Set Default Gamma Lcd_Write_Data(0x00,0x00); Lcd_Write_Data(0x00,0x35); Lcd_Write_Data(0x00,0x00); Lcd_Write_Data(0x00,0x00); Lcd_Write_Data(0x00,0x01); Lcd_Write_Data(0x00,0x02); Lcd_Write_Com(0x00,0xC5); //Set frame rate Lcd_Write_Data(0x00,0x04); Lcd_Write_Com(0x00,0xD2); //power setting Lcd_Write_Data(0x00,0x01); Lcd_Write_Data(0x00,0x44); Lcd_Write_Com(0x00,0xC8); //Set Gamma Lcd_Write_Data(0x00,0x04); Lcd_Write_Data(0x00,0x67); Lcd_Write_Data(0x00,0x35); Lcd_Write_Data(0x00,0x04); Lcd_Write_Data(0x00,0x08); Lcd_Write_Data(0x00,0x06); Lcd_Write_Data(0x00,0x24); Lcd_Write_Data(0x00,0x01); Lcd_Write_Data(0x00,0x37); Lcd_Write_Data(0x00,0x40); Lcd_Write_Data(0x00,0x03); Lcd_Write_Data(0x00,0x10); Lcd_Write_Data(0x00,0x08); Lcd_Write_Data(0x00,0x80); Lcd_Write_Data(0x00,0x00); Lcd_Write_Com(0x00,0x2A); Lcd_Write_Data(0x00,0x00); Lcd_Write_Data(0x00,0x00); Lcd_Write_Data(0x00,0x00); Lcd_Write_Data(0x00,0xeF); Lcd_Write_Com(0x00,0x2B); Lcd_Write_Data(0x00,0x00); Lcd_Write_Data(0x00,0x00); Lcd_Write_Data(0x00,0x01); Lcd_Write_Data(0x00,0x8F); Lcd_Write_Com(0x00,0x29); //display on Lcd_Write_Com(0x00,0x2C); //display on digitalWrite(LCD_CS,HIGH); } [/cce_cpp]