Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] lcd power up issues

2005-04-30 by David Kelly

On Apr 30, 2005, at 2:50 AM, Farzlina Ab.Hadi wrote:

> hi..when i power up the lcd, it will display the two rows of blocks. 
> it only
> display correctly if i power cycle or i reset my circuit.
> does it mean that i need to increase the delay after i power up the 
> lcd or
> some init problems?

Yes, it means one of those two things.

> fyi, i use ksu0069 lcd and i followed the init procedure as in the data
> sheet.

Pay particular attention to the synchronization stage where the 
controller probably resets into 4 bit mode. You don't necessarily know 
if its in the high or low 4 bit stage of an access. If you run the 
interface 8 bits something like this will ensure its in 8 bit mode. I 
haven't seen need to edit my lcd.c file since 1994.

/*
  *	Make sure LCD is in 8 bit mode, 2 lines, font 0
  */
void lcd_sync()
{
	rs_port	&=	~rs_bit;
	e_port	&=	~e_bit;
	rw_port	&=	~rw_bit;	/*  write			*/
	lcd_dr   =  OUTPUT;		/*  change to outputs */

	/*
	 *	If currently in 8bit, 4hi, or 4lo states
	 *	this sequence will end up 8bit
	 */
	wait_ms(15);
	lcd_data = 0x38;		/*  lo nybble second */
	e_port 	|= e_bit;		/*  set E to write 	 */
	e_port 	&= ~e_bit;		/*  end of write	 */

	wait_ms(15);
	lcd_data = 0x38;
	e_port 	|= e_bit;		/*  set E to write 	 */
	e_port 	&= ~e_bit;		/*  end of write	 */

	wait_ms(15);
	lcd_data = 0x38;
	e_port 	|= e_bit;		/*  set E to write 	 */
	e_port 	&= ~e_bit;		/*  end of write	 */

	lcd_dr = INPUT;
	rw_port |= rw_bit;
}

--
David Kelly N4HHE, dkelly@HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.