5
Connecting an 8051 to a 2x16 LCD April 2010 José Da Silva Borges 050503227 Patrício Lima Ferreira 060503038

Microcontroller and LCD interfacing

Embed Size (px)

DESCRIPTION

Connencting an LCD to the 8051 Microcontroller

Citation preview

Page 1: Microcontroller and LCD interfacing

Connecting an 8051 to a 2x16 LCD

April 2010

José Da Silva Borges 050503227 Patrício Lima Ferreira 060503038

Page 2: Microcontroller and LCD interfacing

Connecting an 8051 to a 2x16 LCD 2

Abstract

The goal of this work is program an 8051 microcontroller and connects it to and LCD

display then controls it by a PC with serial port interface. The work is divided by the

following topics:

Initially is shown the schematic of the circuit configuration.

Then is presented the commands which are sent to the LCD display.

And then is presented the flow chart of developed program.

By some simulation is shown some figures with the respective functionalities.

Is finished with some conclusions.

Page 3: Microcontroller and LCD interfacing

Connecting an 8051 to a 2x16 LCD 3

Schematic of the circuit configuration

On the figure bellow is shown the schematic of the circuit that is composed by a 8051

microcontroller, a MAX232 that connects to the serial port, and the LCD display.

Fig. 1 Schematic of the complete circuit.

Interruptions

The microcontroller is set with 2 interruption, the Serial Port interrupt that make

interface with a PC and Timer 0 interrupt that is used to count time to shift the LCD.

Configuration

The serial port is set with 19200 bit/s of baud rate, choosing SMOD = 1 and TH1= 253

that give:

𝐵𝑎𝑢𝑑 𝑟𝑎𝑡𝑒 =𝐾 ∗ 𝐹𝑜𝑠𝑐

32 ∗ 12 ∗ 256 − 𝑇𝐻1

𝐾 = 2 ,𝐹𝑜𝑠𝑐 = 11.0592,𝑇𝐻1 = 253

𝐵𝑎𝑢𝑑 𝑟𝑎𝑡𝑒 =2 ∗ 11.0592

32 ∗ 12 ∗ 256 − 253

𝑏𝑎𝑢𝑑 𝑟𝑎𝑡𝑒 = 19200

Page 4: Microcontroller and LCD interfacing

Connecting an 8051 to a 2x16 LCD 4

LCD Commands

The LCD display is controlled by the microcontroller that is controlled by the PC,

which sends command thought the serial ports.

This works present the follow commands:

Clear the screen of the LCD display, and also the Data RAM memory. This

command is made by pressing 0 on the PC keyboard.

Write on line 1 or line 2 by pressing 1 or 2 respectively on the PC keyboard.

Rotate the display continuously from right to left of the first and the second line.

This command is made by pressing enter key.

Turn on and turn off the display without clearing the memory. This command is

mad by pressing 3 on the PC keyboard.

Flow Chart

The figure bellow shows the flow chart that specifies the action sequence of serial

interrupt routine.

Fig. 2 Flow chart of the serial interrupt routine.

Page 5: Microcontroller and LCD interfacing

Connecting an 8051 to a 2x16 LCD 5

Simulation

The figures bellow represents a simulation made on the software ISIS.

Writing on line 1: Writing on line 2:

Fig. 3 By a Virtual Terminal it sends the command to the LCD

Was presented in this work an 8051 microcontroller/LCD display interfacing, controlled by a PC

through the serial port.

Six commands was implemented and tested, Write on line1, write on line 2, shift left, clear the display,

turn on and turn off.

The circuit was tested with virtual simulation on the ISIS software and then on the laboratory using real

components.

Bibliography

Rickey’s World of Microcontrollers and Microprocessors: LCD interfacing with

Microcontrollers

http://www.8051projects.net/lcd-interfacing/introduction.php

Hantronix Inc.: Displaying Characters on an LCD Character Module

http://www.hantronix.com/down/char-mod.pdf

ISIS Sofware: Demo version

http://www.labcenter.co.uk/download/prodemo_autodl_general.cfm