Uncertain behaviour in ARM microcontroller on reset

hiiiiiiiii,

i am interfacing LCD to my ARM microcontroller (PHILIPS LPC2138).i am able to program the LCD ,but it is uncertain.

the problem is that when i reset my microcontroller or my development board the LCD is programmed and it displays the messages sent to it but when i reset it again it goes blank and after another reset it works fine again.

so LCD gets programmed alternately. also i am using a 16x2 LCD .

please suggest some solution to this .i have initialised the lcd by sending 0x28 , 0x0f,0x01,0x80,0x06 with 20ms duration for each and i am working with LCD in 4 bit mode .

please suggest whether the problem is with microcontroller or with LCD ..however i have tried with three LCD's for same logic.

Reply to
abhay
Loading thread data ...

This is the reason. The LCD powers up in 8-bit mode. You program it into 4-bit mode with a single 8-bit write that has DB0-3 floating; no problem. Then you reset your micro, but the LCD is NOT reset; it is in

4-bit mode still.

The first write that your micro sends on POR is an 8-bit (single write strobe) command to set 4-bit mode. But since the LCD is still in 4-bit mode it expects to see two write strobes before the command is accepted.

Follow the flowcharts in your LCD controller's datasheet more closely, this behavior is avoided if you do so.

Reply to
larwe

hiiiiiiii larwe

I did not get your point "The first write that your micro sends on POR is an 8-bit (single write strobe) command to set 4-bit mode." i have connected only four port pins of my micro to the four MSB's of LCD(D4-D7) so how can i send an 8 bit command .Also i am sending commands only in 4 bit mode as the rest of the pins of LCD are floating .

What do you mean by POR ?

Reply to
abhay

The LCD is in 8-bit mode when it powers up. Therefore the very first command you send it is an 8-bit command (single write strobe), even though your micro is only asserting data on lines 4-7.

I repeat: read the LCD controller datasheet. It will have an initialization sequence documented. The controllers I use specify that the set mode command should be sent three times; the first time with a single write strobe, then two 4-bit commands, with a 37us delay between each.

Power On Reset.

Reply to
larwe

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.