lcdinterfacing

Interfacing LCD with 8051 using C

TELL A FRIEND
  
I am final year electronics engineering student .It is possible for you to send me 8051 to LCD code which I could check. That code should be of C so that i can also debug it easily. i would like u to please provide me the flowchart of the interfacing of microcontroller AT89S51 with LCD display. I need this flowchart for my project. i am new to embedded programming and want c codes for communicating with HD44780 series 20*4 lcd. C code to interface 20X4 LCD to AT89C51...give specific code for lcd initialization.Is a sample code available? C programming code for interfacing LCD to 8051 
 

I want to display ADC output on LCD.Can u give me a hex file.Can i get 8051 to lcd interface program in embedded c format???

The HD44780U standard requires 3 control lines and 8 I/O lines for the data bus.

Control Pins

Enable High to low pulse at this pin makes LCD to latch data from data bus

RS pin is used for selection of either command register (RS=0) or data register (RS=1)

R/W pin allows user to either write data (R/W=0)to LCD or read data (R/W=1)from LCD data bus

Busy flag

Make RS= 0 and R/W =1 to check busy flag .we can read D7 bit of data bus which is busy flag status.

When D7=1 the LCD is busy with internal operation and will not accept any new data.

When D7=0 the LCD is ready to receive new data.

So before sending any data to LCD check that the busy flag is clear.

Here void getReady(void); function is used to check the status of busy flag

Cuiruit Diagram

20x4 LCD data bus is connected to PORT3 of AT89C51.

P3.7 is used to check busy flag

P2.0 is connected to RS pin of LCD

P2.1 is connected to R/W pin of LCD

P2.2 is connected to Enable pin of LCD

LCD Backlight and AT89C51 reset and 12MHz crystal connection are show in circuit diagram.

LCD initialization

Initialize LCD by sending command code using void init(void); and void writeCmd( unsigned char ); functions

0x38 Function set Interface is 8-bit long

0x0E Cursor ON

0x01 Clear LCD

0x06 cursor movement to right direction

0x02 Move cursor to home location

Output on 20x4 LCD using AT89C51

8051 C compilers from www.MicroDigital Ed.com are used here.Compliers create hex files which are downloaded or programmed into the code memory of the microcontroller.Also refer the book “The 8051 Microcontroller and Embedded Systems Using Assembly and C by Mazidi Mazidi McKinlay”

Source Code: C_lcdcode.c HexCode: C_LCDCODE.HEX

Acceptance of ignorance is true path of knowledge -Pujya Dadashri

© 2010 LCD Interfacing.