Re: Problem with interfacing LCD with AT89c51



On Thursday, in article
<7PadndLdmsOVhCvZnZ2dnUVZ_oednZ2d@xxxxxxxxxxxx>
mithun31@xxxxxxxxx "embedidea" wrote:

Hello All,

We are trying to interface 16*2 character LCD with Atmel AT89c51. We are
using ACM1602A. the connection to the 8051 is port 1 is used for data i.e.
DB0-DB7 of LCD and the RS,R/W,E pins to P2.0,P2.1,P2.2 respectively. and
the A and K pins to VCC and Ground respectively.The code for interfacing
is as follows.
-------------------------------------------------------------------------
ORG 0000H;
LJMP MAIN;
ORG 0030H;
MAIN:
ACALL INITIALISE;//first initialising the LCD
MAIN1: MOV A,#'M';
ACALL DISPLAY;
HERE: SJMP HERE;
INITIALISE:
MOV A,#038H;//selecting 2 rows.
ACALL CONFIGURE;

No timing delay

MOV A,#0EH;//displaying the cursor.
ACALL CONFIGURE;

No timing delay

MOV A,#06H;
ACALL CONFIGURE;

No timing delay

RET;
DISPLAY:
MOV P1,A;
SETB P2.0;//Setting RS
CLR P2.1;//Clearing R/W
SETB P2.2;//Setting E.

No timing delay

CLR P2.2;//Clearing E.
RET;

CONFIGURE:
CLR P2.0;//Clearing RS.
CLR P2.1;//Clearing R/W.
MOV P1,A;
SETB P2.2;//Setting E.
CLR P2.2;//Clearing E.
RET;

No delays.

END;
-------------------------------------------------------------------------
Sorry for such a long post.
Awaiting help at the earliest.

If you check the data***(s) for the LCD module and what looks like a
HD44780 or clone interface, has LONG timing delays between actions for
the chip to function. Just doing a basic character write is 1us or more
between actions. Initialisation needs 1ms or more before doing next write.
Exact timings depend on your display.

Do a search on HD44780 code and you will see lots of delays in code.

I suggest you need to time your delays to match your chip. This will need
a scope to measure the timing generated by your software.

The BIG mistake on the HD44780 interface was no interupt/Ready pin to
take to host interface, it is possible to poll a data bit, but this is
not as efficient as an interupt/Ready line.

--
Paul Carpenter | paul@xxxxxxxxxxxxxxxxxxxxxxxxxxx
<http://www.pcserviceselectronics.co.uk/> PC Services
<http://www.gnuh8.org.uk/> GNU H8 & mailing list info
<http://www.badweb.org.uk/> For those web sites you hate

.