/* Written By: Ethan Daugherty Library for the SSD1963 Used for reference: SSD1963 DATA SHEET Library: TFT 2.4" LCD - ili9341 Written by: Mohamed Yaqoob (Not from scratch, but referring to many open source libraries) Date written: 20/01/2018 Description: This library makes use of the FSMC interface of the STM32 board to control a TFT LCD. The concept shown here is exactly the same for other TFT LCDs, might need to use 16 bits for some LCDs, but the method is similar. You can use this as a starting point to program your own LCD and share it with us ;) */ //includes #include "SSD1963_test.h" ///////SSD1963 (8BIT,16BIT-MCU 8080 main,Write Command,Data)/////// unsigned int GATE; unsigned int SOURCE; unsigned long color_1,color_2,color_3,color_4; void Write_Command(uint8_t command) { //IC_RD = 1; //IC_A18 = 0; //IC_WR = 0; //IC_CS = 0; //Send Command to the Data Bus *(__IO uint8_t *)(0x60000000) = command; //IC_CS = 1; //IC_WR = 1; } //================================= void Write_Data(uint8_t data1) //8bit data { //IC_RD = 1; //IC_A18 = 1; //IC_WR = 0; //IC_CS = 0; //Send data to the Data Bus *(__IO uint8_t *)(0x60080000) = data1; //IC_CS = 1; //IC_WR = 1; } //================================= void Command_Write(uint8_t command,uint8_t data1) { Write_Command(command); Write_Data(data1); } //------------------------------------------------------------------------------ // 70G,Q initial //------------------------------------------------------------------------------ void SSD1963_70Q(void) { GATE = 480; SOURCE = 800; Write_Command(0x01); //Software Reset, need a 5ms delay HAL_Delay(10);// 10ms delay //Set PLL //REF CLK = 10MHz //VCO = REF CLK * (M+1) //250MHz < VCO < 800MHz //PLL FREQ = VCO/(N+1) //PLL MAX = 110MHz Write_Command(0xE2);// Set PLL, PLL = 100 MHz Write_Data(0x1D);//M = 29 Write_Data(0x02);//N = 2 Write_Data(0x04);//set multiplier and divider into effect Command_Write(0xe0,0x01); //START PLL, need 100us to have PLL stable HAL_Delay(2);//2ms delay Command_Write(0xe0,0x03); //LOCK PLL HAL_Delay(2); Write_Command(0xb0); //SET LCD MODE SET TFT MODE Write_Data(0x00); //SET 18Bit Disable TFT FRC & dithering,DCLK in falling edge Write_Data(0x00); //SET TFT mode Write_Data(0x03); //SET horizontal size=800-1 HightByte Write_Data(0x1F); //SET horizontal size=800-1 LowByte Write_Data(0x01); //SET vertical size=480-1 HightByte Write_Data(0xDF); //SET vertical size=480-1 LowByte Write_Data(0x00); //SET even/odd line RGB seq.=RGB //8bit(666) Command_Write(0xf0,0x00); //SET pixel data I/F format=8bit Command_Write(0x36,0x00); // SET read from frame buffer to the display is RGB //set pixel clock //pixel clock = width*height*color depth* refresh rate Write_Command(0xe6); //SET pixel clock frequency Write_Data(0x04); Write_Data(0x6F); Write_Data(0x47); Write_Command(0xb4); //SET HBP, Write_Data(0x04); //SET HSYNC Total = 1056 Write_Data(0x20); Write_Data(0x00); //SET HBP = 46 Write_Data(0x2e); Write_Data(0xd2); //SET VBP 210 Write_Data(0x00); //SET Hsync pulse start position Write_Data(0x00); Write_Data(0x00); //SET Hsync pulse subpixel start position Write_Command(0xb6); //SET VBP, Write_Data(0x02); //SET Vsync total 525 Write_Data(0x0d); Write_Data(0x00); //SET VBP = 23 Write_Data(0x17); Write_Data(0x16); //SET Vsync pulse 22 Write_Data(0x00); //SET Vsync pulse start position Write_Data(0x00); Write_Command(0x2a); //SET column address Write_Data(0x00); //SET start column address=0 Write_Data(0x00); Write_Data(0x03); //SET end column address=799 Write_Data(0x1F); Write_Command(0x2b); //SET page address Write_Data(0x00); //SET start page address=0 Write_Data(0x00); Write_Data(0x01); //SET end page address=479 Write_Data(0xDF); Write_Command(0x29); //SET display on Write_Command(0x2c); } //================================= void SSD1963_RAM_Address() //Set SSD1963 Ram address { Write_Command(0x2a); //SET column address Write_Data(0x00); //SET start column address=0 Write_Data(0x00); Write_Data(0x03); //SET end column address Write_Data(0x1F); Write_Command(0x2b); //SET page address Write_Data(0x00); //SET start page address=0 Write_Data(0x00); Write_Data(0x01); //SET end page address Write_Data(0xDF); Write_Command(0x2c); } /*******************************************/ //Test for all white or black or red or blue or green /*******************************************/ void SSD1963_Show_RGB(uint8_t dat1,uint8_t dat2,uint8_t dat3) { unsigned int i,j; SSD1963_RAM_Address(); for(i=0;i