Altera_Forum
Honored Contributor
15 years agoGraphics LCD problem with Cyclone III FPGA Development Kit
Can anybody help me: I have battled for a while to get the 128x64 graphics lcd on the Cyclone III working. I eventually got it working, but used seperate PIO pins, seeing that i could not get hold of an IP core that is supported by the HAL. Anyway, here is the code i used for initializing the LCD:
void glcd_init(void) { IOWR_ALTERA_AVALON_PIO_DATA(GLCD_REN_BASE, 1); // Set all glcd pins HIGH IOWR_ALTERA_AVALON_PIO_DATA(GLCD_WEN_BASE, 1); IOWR_ALTERA_AVALON_PIO_DATA(GLCD_D_CN_BASE, 1); IOWR_ALTERA_AVALON_PIO_DATA(GLCD_EN_BASE, 1); IOWR_ALTERA_AVALON_PIO_DATA(GLCD_RSTN_BASE, 0); // Hard reset usleep(20); // Wait 20us; IOWR_ALTERA_AVALON_PIO_DATA(GLCD_RSTN_BASE, 1); // Release reset; usleep(100000); // Wait 100ms); glcd_writeByte(0, 0xe2); // Internal Reset glcd_writeByte(0, 0xa2); // Bias = 1/9; 0xa3 for 1/7 glcd_writeByte(0, 0xa1); // ADC = 1 (right to left); 0xa0 for 0(left to right) glcd_writeByte(0, 0xc0); // Common direction = Normal; 0xc1 for inverse glcd_writeByte(0, 0x28); // Set Power Control - Internal power circuits OFF ******* but looks better with 0x2f glcd_writeByte(0, 0xe7); // Set Driver ON; 0xe6 for OFF glcd_writeByte(0, 0xaf); // Display ON; 0xae for OFF glcd_writeByte(0, 0xa5); // Entire Display ON - Turn ON all pixels (irrespective of RAM) usleep(500000); // Wait 500ms glcd_writeByte(0, 0xa4); // Entire Display NORMAL - Pixels correspond to display RAM } The code works perfectly and I can even turn pixels on and off anywhere on the display. The problem however is that when i switch a pixel on, the rest of that column also lights up slighty (but is definately not on). It is annoying because when i draw graphics on the lcd, it looks like there are ghost images next to the graphics i am drawing. I suspected that it could be something to do with the supply voltages V1 to V5 that the board provides to the LCD, but they seem within range according to the datasheet - and besides - surely Altera double checked these values before building the board. I would really appreciate any help. I have tried contacting the people from Altera that our university normal deals with, but i havent had a single reply from Altera yet. Just as a matter of curiosity - do any of you deal with Xilinx products and what are their support like?