Writing Output to an LCD

Hitachi 44780 Based LCD Pinout

Pin

Symbol

Description

1

Ground

Ground, 0 Volts

2

Vcc

Power, 5 Volts (for logic)

3

Vee

Power for LCD, 0 to 5 volts, the level determines the contrast of the LCD. Typically obtained from a 10k to 20 k Ohm pot.

4

RS

Register Select - Determines whether data bus is communicating instructions to control the LCD or data to be displayed. 1 - Data, 0 - Instruction

5

R/W

Read Write 1- reads from LCD, 0- writes to LCD

6

E

Enable (clock) signal

timing is rather complicated, RS, R/W and Data must be present as E goes from low to high. E must stay high for at least 450 ns.

7-14

D0 to D7

8 bit bidirectional Data

Register Select

Flash Basic can look after the details of communication if you wish to make a program to display data on an LCD display.

Assignment : Create and compile the following program. Connect an LCD display and test the program.

By modification of the program determin the following;

1. Demonstrate the LCD operation of the functions, clear, home, mode, control and shift.

2. Print a variable, and demonstrate what the "print at" does.

 

Creating the program;

using
PIC 16F877
FREQ 4
OSCILLATOR CRYSTAL
      
code in the interpreter
'Flash Basic
        ADC_Config 0, 0, 1, 6, 0
        LCD_Config 1, 0, 0, 0, 1, 1, 0, E, 0, E, 1, E, 2, D
        Print "hello world", 0, 0
      

The Analog to Digital Command

the LCD_Config Command

Set up as shown. Most of this is self explanitory. This is a two line display with 5*8 pixels for each character. RS, R/W, Enable and Data define which pins on the pic are used for these functions.

Compile using MPLAB

Program using Warp 13 - see settings below

Connect the chip see http://ww1.microchip.com/downloads/en/DeviceDoc/39582b.pdf (page 5)for pin diagram of 16F877A (40 pins)

 Good Luck
Technological Design Home