Welcome to Sandeep's Homepage

Home

 

PIC to LCD interface

This article here is about how to interface PIC with LCD. Here in this project I am using PIC 16F84A and HD44780 compatible LCD. Though any character and line LCD can be used as long as it has HD44780 based controller, with minor software changes (see LINE2 routine in code), I used 16x2 line LCD. LCD can be interfaced both in 8 bit and 4 bit mode. I am using 4 bit interface mode so Port A and bit 0 of port B of PIC are free for any use. Letís start with schematic. See the table for complete connection details.

LCD connection details

LCD Pin no.

Description

Connected to

1

Vss

0v

2

Vdd

5v

3

VO Contrast adjust

Potential divider

4

RS Register Select

RB1(Port-B Bit-1) of PIC (Pin 7 of PIC)

5

R/W Read/Write

RB2 of PIC(Pin 8)

6

E Enable

RB3 (Pin 9)

7

DB0 Data Bit 0

Not used

8

DB1 Data Bit 1

Not used

9

DB2 Data Bit 2

Not used

10

DB3 Data Bit 3

Not used

11

DB4 Data Bit 4

RB4 (Pin 10)

12

DB5 Data Bit 5

RB5 (Pin 11)

13

DB6 Data Bit 6

RB6 (Pin 12)

14

DB7 Data Bit 7

RB7 (Pin 13)

15

A(+) Backlit

5v thru current limiting resistor see LCD manual for max current

16

K(-) Backlit

0v

The code provided writes HELLO WORLD! in the first line and LINE 2 in the second line, just for demo. Modify it for your purpose. download the source and hex from the link below.

LCD4Bit.asm
LCD4Bit.hex

Related Documents

HD44780 datasheet
PIC16F84A datasheet

My Email: s_guria@indiatimes.com

 

 

Free Web Page Hit Counters
Free Hit Counter