Download Lab Manual - CS Course Webpages
Transcript
Lab 5: LCD Device Driver 5.1 OBJECTIVE The purpose of this lab is to write a device driver interfacing an LCD character display to the GPIO. The device driver provides a high-level interface to communicate with a hardware device, and hides many of the details of using it. You will write a simple interactive program using the driver. 5.2 INTRODUCTION In order to implement this lab, you will use the GPIO interface of the MCF5206e. As discussed in Lab 4, the GPIO is located at address 0x40000001, after the proper chip select initialization code has been executed. This forms a word with the LED display. You will use the GPIO to communicate with the Optrex LCD DMC20434 character display. 5.3 PROCEDURE You will first write a device driver for the LCD. This will consist of a library of subroutines and state variables that hide the details of communicating with the LCD. You will then write a client program using the device driver. The Device Driver A device driver is a set of subroutines which simplify the interface with I/O devices so that client programs can communicate with them. For this lab you will write an LCD device driver and a client program using its functions. Your device driver will handle the bit control and read/write operations while your client program will simply call the subroutines and pass data in parameters. The LCD device driver must implement the subroutines given below. The parameters will be passed on the stack, and any strings should be passed by reference (i.e. address). • Reset() - This function should not only clear the display, but perform all necessary steps to initialize the display after a system reset. The cursor mode after a reset should be blinking. • CursorPosition(x) - Moves the cursor to column x on the display. Must not affect any data already displayed. • ShiftDisplay(x,y) - x is the character 'r' or 'l' specifying a right or left shift, respectively. y is an integer which specifies how many characters to shift the display. This should be able to shift any number from 1 to 80 in decimal. • Backspace() - Should behave just like the "Backspace" key on your keyboard. i.e., it moves the cursor back one space and deletes the character at that position. • Write(string) - Writes a null-terminated character string to the display at the current position. string should be the address of a null-terminated array of ASCII characters. • CursorControl(x) - x will be the letter 'b' for blinking, 'l' for line or 'x' to turn off the Lab 6: Keypad Entry Page 30