• We recently switched our forum platform. If you experience any issues please email support@crystalfontz.com

LCD programming help

steveszol

New member
hi

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
Code:
void modecontrol(void)
		{
		
PORTC = 0x00;  //write 00H into instruction reg//

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

lcdenable();
busyflag();

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

PORTA &= ~0x08; //RS=0 data
		lcdenable();
		busyflag();
		
		}

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

Steve
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 ;) .

https://forum.crystalfontz.com/showthread.php?s=&threadid=3619

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