Problem with interfacing LCD with AT89c51

Hello All,

We are trying to interface 16*2 character LCD with Atmel AT89c51. We ar 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. an the A and K pins to VCC and Ground respectively.The code for interfacin 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; MOV A,#0EH;//displaying the cursor. ACALL CONFIGURE; MOV A,#06H; ACALL CONFIGURE; RET; DISPLAY: MOV P1,A; SETB P2.0;//Setting RS CLR P2.1;//Clearing R/W SETB P2.2;//Setting E. 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; END;

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

Thanks in advance.

Reply to
Loading thread data ...

No timing delay

No timing delay

No timing delay

No timing delay

No delays.

If you check the datasheet(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          |
    PC Services
 Click to see the full signature
Reply to
Paul Carpenter

Try this

formatting link

its very simple and usefull.

Marios Lazos

Reply to
Marios Lazos

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.