Forum Discussion
Altera_Forum
Honored Contributor
15 years agoYour problem is that you replaced my glcd_write() parts of the code by directly writing to the port pins. This is the crucial initializing step and should be done as i did in my code using the following glcd_write() function:
void glcd_writeByte(int DI, int data) { if (DI == 1) { IOWR_ALTERA_AVALON_PIO_DATA(GLCD_D_CN_BASE, 1); //write a command; } else { IOWR_ALTERA_AVALON_PIO_DATA(GLCD_D_CN_BASE, 0); //write data; } IOWR_ALTERA_AVALON_PIO_DATA(GLCD_DATA_BASE, data); //put DATA on the data lines; usleep(2); //wait 2 us IOWR_ALTERA_AVALON_PIO_DATA(GLCD_EN_BASE, 0); //pull the ENABLE pin low to enable writing to the LCD usleep(2); //wait 2 us IOWR_ALTERA_AVALON_PIO_DATA(GLCD_WEN_BASE, 0); //pull the Write Enable pin low to enable writing to the LCD usleep(2); //wait 2 us IOWR_ALTERA_AVALON_PIO_DATA(GLCD_WEN_BASE, 1); //pull the ENABLE pin high to disable writing to the LCD IOWR_ALTERA_AVALON_PIO_DATA(GLCD_EN_BASE, 1); //pull the Write Enable pin high to disable writing to the LCD } This should then work. Just another thing: the data pins should actually be bi-directional pins to allow reading from the GLCD as well - just thought i will mention it. I would like to know if this works with your display and what the display looks like after you have initiallized it.