LCD interface with Microcontroller PIC: Beginner’s guide using pic microcontoller
How to interface LCD (Liquid Crystal Display) display module to PIC microcontroller? LCD is a passive component, that is it does not make any light but just modifies the light passing through it for alphanumeric displays. LCD is exclusively manufactured to be used with microcontrollers, which means that it cannot be triggered by usual IC circuits. This embedded program shows how to connect PIC to LCD display module with microcontroller programming.Here 16×2 LCD interfaces with the PIC microcontroller. This type of LCD screen can display 2 lines with 16 characters each. Every character consists of 5×8 or 5×11 dot matrix. It can display all the letters of alphabet, Greek alphabet, mathematical symbols, punctuation marks etc. It is also likely to display symbols prepared by the user. Other positive features consist of automatic message shift (left and right), cursor appearance, LED back light etc. Interfacing LCD to microcontroller is quite simple program for beginners and easy to understand.
EN – Enable:
This control line is used to inform the LCD that you are sending in data. To send data to the LCD, put data on the data bus, then make EN high (1) and wait a little bit and end by bringing EN to low (0) again.
RS – Register Select:
When RS is low (0), the information in the DB0 to DB7 pins are to be considered as an instruction (command- such as Clear screen, Display set, etc.). When RS is high (1), the information in the DB0 to DB7 pins are to be considered valid text data to print on the LCD screen. For example, to display the letter “i” on the screen you should set RS= high.
RW – Read/Write:
When RW is low (0), the information on the data bus is written to the LCD module.
DB0 to DB7:
Data bus lines of LCD display.
Used for enabling back light on the screen. If you don’t want the back light you can leave it unconnected.
Basic connection circuit diagram of LCD interfacing with PIC
- We can interface LCD to PIC in 4 bit mode
- So D0, D1, D2, D3 of LCD display are grounded since connection is 4 bit mode and the D4, D5, D6, D7 are connected to Port C higher bits RC4, RC5, RC6, RC7 respectively.
- RS pin of LCD module connected to RC2 (PORTC.F2), this will decide whether the LCD inputs are data input or instruction input. In the case of Mikro C compiler we doesn’t bother about this pin, only we need to initialize it as sbit LCD_RS at RC2_bit; rest all the operation done by LCD Library function inside Mikro C.
- RW (Read/Write) pin grounded because we are writing to LCD display. (For writing RW=0; For reading RW=1;)
- Enable (EN) pin connected to RC3 (PORTC.F3), a HIGH to LOW transition of this pin needed in order to transfer data or command from PIC to LCD module. As I said above, Mikro C LCD library function will do the job for us. Just initialize the bit as sbit LCD_EN at RC3_bit;
Fo more detail: LCD interface with Microcontroller PIC: Beginner’s guide
Current Project / Post can also be found using:
- lcd interface microcontroller