Already on ArticleSlash?

Forgot your password? Sign Up

Adding a Keyboard and LCD to a Microcontroller

 


Visitors: 551
 2 votes

One of the problems in using a microcontroller is that unlike a PC there is no user interface i. e. No screen or keyboard.

Reading Keys

There are many ways to read a keyboard depending on what you need to do for example:

1. Add an individual key to each input port (with pullup resistor).

2. Multiplex many keys to a few inputs (using the tristate microcontroller capability).

3. Interface a PC keyboard (using a serial interface).

4. Use a built in ADC to read a set of resistor coded key inputs.

. . and probably many more methods.

Text output

Generating text output is more complex because there are no simple devices to do the job but there are two easy choices either:

  • Serial port to PC
  • LCD

Serial Port

Using a PC serial port is fairly easy and only requires a level translator chip e. g. MAX232 then you can output text data to the PC screen. This is useful for debugging and developing a PC based application but no good for stand alone operation. For that you need to use an LCD.

LCD

The simplest LCD interface is a 16 by 2 line LCD module usually using the standard HD44780 controller. The controller makes it easy to use the LCD as all the difficult LCD interface is contained within the HD44780. All you need to do is send it the correct data through a parallel interface to display a character.

LCD Debugging

You can also use the LCD as a debugging tool since the data displayed is retained on the display while power is applied so there is not much processing overhead in using an LCD. Another advantage over the serial display is that you can update it very quickly e. g 1 character in 40 microseconds compared to milliseconds for the serial interface (depending on serial speed selected).

LCD problem

The only real problem with the LCD is that is takes up a lot of pins 11 (if you use the full 8 bit interface) but you can reduce this by using the nibble interface to 7 pins and reduce this further to 6 if you don't need to read from the device (HD44780 has RAM inside).

Another option if you have very few pins is to use a serial LCD and this uses just one pin. Obviously this is slower as it uses a serial protocol and it is also more expensive as the serial LCD will need a serial to parallel controller on board.

Programming

For both methods modern compilers fully support the device i. e. RS232 and HD44780 so you don't need to start coding at a very low level (the HD44780 has a complex startup sequence) and you can just plug in your chosen device start using it.

Sign up for Microzine to find out how to combine an LCD and 12Key keypad on a single 8 bit port using no hardware interface chips. MicroZine sign up

P. S. The LCD Keypad project is FREE.

John Main's website http://www.best-microcontroller-projects.com provides microcontroller resources and free projects which are fully documented and include schematics and source code.

Free to distribute if the article is kept complete including the Author Bio.

(584)

Article Source:


 
Rate this Article: 
 
Atmega103 microcontroller-based child home information terminal design
Rated 1.0 / 5
based on 2 votes
ArticleSlash

Related Articles:

Keyboard Lessons For Beginners - Drills That Prepare You for Keyboard Lessons

by: Reid Schirmer (March 21, 2011) 
(Arts and Entertainment/Music)

Development trend of Microcontroller

by: Zerry Xu (January 18, 2011) 
(Computers and Technology)

C51 microcontroller applications and programming

by: Zerry Xu (January 19, 2011) 
(Computers and Technology)

The 12F675 - A PIC Microcontroller Project Guide

by: John Main (June 05, 2007) 
(Computers and Technology)

With Config bits in microcontroller-based projects

by: Zerry Xu (March 01, 2011) 
(Computers and Technology)

Is the PIC 16F84 Dead? - The Most Popular Microcontroller Of All Time

by: John Main (April 15, 2008) 
(Computers and Technology/Hardware)

FM radio receiver clock generator and microcontroller design

by: Zerry Xu (December 03, 2010) 
(Computers and Technology)

Atmel introduced the 32-bit floating point unit with AVR microcontroller (MCU) ..

by: Zerry Xu (January 07, 2011) 
(Computers and Technology)

Infineon scalable 8-bit microcontroller complete high-temperature series

by: Zerry Xu (January 12, 2011) 
(Computers and Technology)

Atmega103 microcontroller-based child home information terminal design

by: Zerry Xu (May 03, 2011) 
(Computers and Technology)