Try this
http://www.8052.com/tutlcd.phtml
its very simple and usefull.
Marios Lazos
"Paul Carpenter" <paul$@pcserviceselectronics.co.uk> wrote in message news:20060713.1114.318554snz@pcserviceselectronics.co.uk...
> On Thursday, in article
> <7PadndLdmsOVhCvZnZ2dnUVZ_oednZ2d@giganews.com>
> mithun31@gmail.com "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 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 | paul@pcserviceselectronics.co.uk
> <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
>
Reply by ●July 13, 20062006-07-13
On Thursday, in article
<7PadndLdmsOVhCvZnZ2dnUVZ_oednZ2d@giganews.com>
mithun31@gmail.com "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;
> 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 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 | paul@pcserviceselectronics.co.uk
<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
Reply by embedidea●July 13, 20062006-07-13
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;
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.