okay im at wits end, after going over this 500 times the last couple days i still cant get this lcd to work...
info
this is the lcd i bought based off SSD1963 driver
http://www.ebay.ca/itm/5-5-0-inch-TFT-LCD-module-Font-IC-800x480-SSD1963-arduino-DUE-MEGA2560-3-5-7-3-/111005370687?pt=LH_DefaultDomain_0&hash=item19d86f893f
I have been unable to find any atmega libraries for the SSD1963 so aftergetting copies from the arduinos, pic, and the SSD1963 datasheet and what not for reference's ive done my own library.
So at the end of my init routine it should turn the screen red, and all i get from my lcd is a white screen, so it looks like its turning on but thats about it.....Anybody able to help me figure whats wrong
ftf.c
#include#include #include #include #include #include "TFTLCD.h" #define sbi(pin) CONPORT |= pin #define cbi(pin) CONPORT &= ~pin #define pulse_high(pin) sbi(pin); cbi(pin); #define pulse_low(pin) cbi(pin); sbi(pin); #define swap(i, j) {int t = i; i = j; j = t;} int fcolorr = 0; int fcolorg = 0; int fcolorb = 0; int bcolorr = 0; int bcolorg = 0; int bcolorb = 0; void Setxy(int x1, int y1, int x2, int y2); void clrxy(void); void SetColor(int r, int g, int b); void SetBackground(int r, int g, int b); void TFT_Write_Bus(char VL); void TFT_WRITE_COM(char VL); void TFT_WRITE_DATA(char VL); void TFTinit(void); void clrScr(void) { int i; int j; cbi(CS); clrxy(); for (j=0; j<480; j++) { for(i=0; i<800; i++) { TFT_WRITE_DATA(bcolorr); TFT_WRITE_DATA(bcolorg); TFT_WRITE_DATA(bcolorb); } } } void clrxy(void) { Setxy(0, 0, 800, 480); } void SetColor(int r, int g, int b) { fcolorr = r; fcolorg = g; fcolorb = b; } void SetBackground(int r, int g, int b) { bcolorr = r; bcolorg = g; bcolorb = b; } void TFT_Write_Bus(char VL) { DATAPORT = VL; pulse_low(WR); } void TFT_WRITE_COM(char VL) { cbi(RS); TFT_Write_Bus(VL); } void TFT_WRITE_DATA(char VL) { sbi(RS); TFT_Write_Bus(VL); } void TFTinit(void) { sbi(RST); sbi(CS); sbi(RD); sbi(WR); sbi(RS); _delay_us(5); cbi(RST); _delay_us(15); sbi(RST); _delay_us(15); cbi(CS); _delay_us(100); TFT_WRITE_COM(0xE2); //Set PLL TFT_WRITE_DATA(0x1E); //m=30 TFT_WRITE_DATA(0x02); //n=2 TFT_WRITE_DATA(0x04); //Use MN values TFT_WRITE_COM(0xE0); //Start PLL at 103Mhz TFT_WRITE_DATA(0x01); _delay_us(100); TFT_WRITE_COM(0xE0); //Enable PLL TFT_WRITE_DATA(0x03); _delay_us(10); TFT_WRITE_COM(0x01); //software reset _delay_us(100); TFT_WRITE_COM(0xE6); //PCLK speed based off PLL Freq 33Mhz TFT_WRITE_DATA(0x01); TFT_WRITE_DATA(0x48); TFT_WRITE_DATA(0x13); TFT_WRITE_COM(0xB0); //LCD Spcifications TFT_WRITE_DATA(0x24); TFT_WRITE_DATA(0x00); TFT_WRITE_DATA(0x03); //Set HDP 799 TFT_WRITE_DATA(0x1F); TFT_WRITE_DATA(0x01); //Set VDP 479 TFT_WRITE_DATA(0xDF); TFT_WRITE_DATA(0x00); TFT_WRITE_COM(0xB4); //HSYNC TFT_WRITE_DATA(0x03); //Set HT 928 TFT_WRITE_DATA(0xA0); TFT_WRITE_DATA(0x00); //Set HPS 46 TFT_WRITE_DATA(0x2E); TFT_WRITE_DATA(0x30); //Set HPW 48 TFT_WRITE_DATA(0x00); //Set LPS 15 TFT_WRITE_DATA(0x0F); TFT_WRITE_DATA(0x00); TFT_WRITE_COM(0xB6); //VSYNC TFT_WRITE_DATA(0x02); //Set VT 525 TFT_WRITE_DATA(0x0D); TFT_WRITE_DATA(0x00); //Set VPS 16 TFT_WRITE_DATA(0x10); TFT_WRITE_DATA(0x10); //Set VPW 16 TFT_WRITE_DATA(0x00); //Set FPS 8 TFT_WRITE_DATA(0x08); TFT_WRITE_COM(0xBA); TFT_WRITE_DATA(0x0F); //GPIO[3:0] out 1 TFT_WRITE_COM(0xB8); TFT_WRITE_DATA(0x07); //GPIO=Input, GPIO[2:0]=output TFT_WRITE_DATA(0x01); //GPIO0 Normal TFT_WRITE_COM(0x36); //Rotation TFT_WRITE_DATA(0x22); TFT_WRITE_COM(0xF0); //Set pixle interface TFT_WRITE_DATA(0x00); _delay_us(1); Setxy(0,0,799,479); TFT_WRITE_COM(0x29); //Turn LCD On TFT_WRITE_COM(0xBE); //Set BL TFT_WRITE_DATA(0x06); TFT_WRITE_DATA(0xF0); TFT_WRITE_DATA(0x01); TFT_WRITE_DATA(0xF0); TFT_WRITE_DATA(0x00); TFT_WRITE_DATA(0x00); TFT_WRITE_COM(0xD0); TFT_WRITE_DATA(0x0D); TFT_WRITE_COM(0x2C);/start memory write sbi(CS); SetColor(255,255,255); SetBackground(255,0,0); Setxy(0,0,0,0); clrScr(); } void Setxy(int x1, int y1, int x2, int y2) { //int tmp; swap(x1, y1); swap(x2, y2); TFT_WRITE_COM(0x2A); TFT_WRITE_DATA(x1); TFT_WRITE_DATA(x2); TFT_WRITE_COM(0x2B); TFT_WRITE_DATA(y1); TFT_WRITE_DATA(y2); TFT_WRITE_COM(0x2C);//write Memory Start }
tft header file
#define DATAPORT PORTA //D0-7 #define CONPORT PORTC #define WR 1 #define CS 2 #define RD 4 #define RS 3 #define RST 6 void Setxy(int x1, int y1, int x2, int y2); void clrxy(void); void clrSr(void); void SetColor(int r, int g, int b); void SetBackground(int r, int g, int b); void TFT_Write_Bus(char VL); void TFT_WRITE_COM(char VL); void TFT_WRITE_DATA(char VL); void TFTinit(void);
main code
#include#include #include #include #include #include #include "TFTLCD.h" #define F_CPU 8000000 int main(void) { DDRA = 0xFF; DDRC = 0xFF; DDRD = 0xFF; void TFTinit(void); while(1) { PORTD ^= 0xFF;// heart beat _delay_ms(1000); } }