LCDInfo.com
http://forum.lcdinfo.com/

Crystalfontz LCD help
http://forum.lcdinfo.com/viewtopic.php?f=9&t=1359
Page 1 of 1

Author:  steveszol [ Fri Sep 23, 2005 20:27 ]
Post subject:  Crystalfontz LCD help

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

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

Author:  seulater [ Thu Mar 16, 2006 22:23 ]
Post subject: 

steveszol,

Your lcdenable() routine is not corect.

when sending data to the LCD you need to put the data on the bus and then bring E high then low. you have it the other way arround.

P.S. i dont know what xtal your running the Mega32 at but i would give quite a bit more delay so that you leave the E line high longer than 1 nop time length. start out with 1ms i know its a long time but that will rule out one possible problem anyway. you can allways shorten your delays later after you get it working properly.


Good luck!
Jim

Page 1 of 1 All times are UTC + 2 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/