LCD programming help


New member

i am new to graphic lcdsand have bought the CFAG160x160 Crystalfontz Graphic LCD Module

i am interfacing it to a Atmel ATMEGA 32 microcontroller

i basically just need to have it display text using the internal character generator

i have started to write code for it in C but have run into many problems. All i have on the screen is a few vertical lines.

here is a bit of my code for the mode control
void modecontrol(void)
PORTC = 0x00;  //write 00H into instruction reg//

PORTA |= 0x08; //RS=1 instruction


PORTC = 0x30; //display on, master, Char Mode, Built-in CG//

PORTA &= ~0x08; //RS=0 data

void lcdenable(void)
PORTA &= ~0x02;  //Enable pin low//
asm volatile ("nop");
PORTA |= 0x02;  //Enable pin high//
any help would be great, thanks

Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
Your "lcdenable()" function seems to be exactly backwards. The E signal should start low, then go high, then return low.

You can look at my C code package, and get some ideas, at least for the low level control functions. The init portion will not be of any use to you, nor will the graphic text stuff. But, hey, the cost to have a look is very low ;) .

Since I'm not familiar with the Sanyo controller, I won't attempt to go into the setup (init).