CS122A: Lab 4


Objectives:
Introduction
In this lab, you will continue work with the 8051 and interface with a Liquid Crystal Display (LCD) unit. The output you will display on the LCD depends on which of three modes your main program is in:
  1. A Start_LCD mode in which the LCD displays a "Ready..." string.
  2. A Load mode in which the LCD displays a user-inputted number.
  3. A Count Up/Down mode in which the LCD will display the numbers 0 to 15 in an ascending or descending sequence.
You will take existing LCD interface code and use its functions to write a main program implementing the above functionality.

You will wire a breadboard with the necessary components to physically demonstrate a working system after downloading your compiled program to an 8051.

Part 1
The three modes will be selected using an external DIP switch. Depending on the DIP switch your materials pack has, you may not use all the pins on the switch. Use the following schematic. You should refer to the 8051 Pinout Diagram in assembling your circuit.
In case you need to know, breadboards are configured such that certain sockets are connected together, like so:
Note that you have not been provided with a chip socket, so you must leave adequate room for the 8051. The 8051 has 20 pins on either side.

Warning: Previous quarters have not treated the DIP switches kindly. Please use a blunt edge such as the head of a flathead screwdriver to ease the switch out of the socket from both sides - do not pry the DIP switch off by hand. Be similarly cautious with the LCD unit.

Part 2
You will now write code to interface with the LCD. Note: You must not add new sbit variables.

Hint: If you wanted to extract the four most significant bits of the number 0x5B, the C syntax would be: (0x5B >> 4) & 0xF

Extra Credit
Hint: The LCD screen is divided into two halves. GoToXY(r,c) may prove useful.
End of Lab
Prepared 10/12/04 by Ryan Mannion