CE-2800 Embedded Systems Software
Lab 6: LCD Messages

Objectives

Assignment

In this lab, you are to write a program that makes use of (i.e. calls subroutines from) the display_dd.asm and delay.asm files to implement the functionality described below. Your "main" program should be placed in a file named Lab6.asm.

Completing rs232_dd.asm

First, complete the rs232_sendMessage subroutine in the rs232_dd.asm file you began in the previous lab assignment. This subroutine transmits a character string of arbitrary length - to do so, this subroutine must make repeated calls to the rs232_sendByte subroutine to transmit each individual character in the string. The "arguments" to the rs232_sendMessage subroutine are specified in the table below:

message (R30:R31, or Z register)

This is the 16-bit address of the character string in Program Memory that is to be transmitted. Note that the string does not have to be null-terminated!

length (R23)

The length (in bytes, or characters) of the string to be transmitted.

There is no return value from rs232_sendMessage.

LCD display driver: display_dd.asm

The file display_dd.asm, which you must write from scratch, will contain several subroutines that initialize and control the functionality of the LCD display. The subroutines you are to implement must conform to the following "interface" specification:

  1. display_init – Initializes the LCD display by invoking the rs232_init subroutine (which you have already implemented in rs232_dd.asm) with the correct "arguments" appropriate for the LCD (i.e. baud rate, parity, etc). It also turns the backlight off, and sets the cursor on with character blink (by calling rs232_sendByte with appropriate arguments as described in the LCD technical documentation). The display_init subroutine takes no arguments and returns nothing. Note: be sure this subroutine incorporates a 20ms delay before sending data to the LCD, in order to give the LCD sufficient time to boot during power up.
  2. display_clear – clears the LCD display by calling rs232_sendByte with appropriate arguments. Takes no arguments and returns no value. Note: be sure this subroutine incorporates a delay of at least 5ms before returning in order to give the LCD time to clear.
  3. displayMessage – Displays a string to the LCD display by calling rs232_sendMessage with appropriate arguments. The arguments to displayMessage are specified in the table below:

    message (R30:R31, or Z register)

    This is the 16-bit address of the character string in Program Memory that is to be displayed. Note that the string does not have to be null-terminated!

    length (R23)

    The length (in bytes, or characters) of the string to be displayed.

    There is no return value from displayMessage.

  4. display_gotoLocation – positions the cursor to a specific location within the LCD display. The argument to this subroutine is passed via R23, which contains one of the 32 opcodes described in the LCD technical documentation that specify the cursor position. This subroutine returns no value.

Keypad driver: keypad_dd.asm

Download this keypad2_dd.asm file, whose subroutines you will use within your Lab5.asm program. You needn't make any modifications to this code, but in your Lab5.asm file you will have to define three aliases as described at the top of keypad2_dd.asm. The use of the subroutines are documented within the file itself, but you may find the following table useful in terms of documentation of the values that are returned in R25 and R24 as a result of calling the keypad_read subroutine.

Key R25 R24
none 0 0
0 0 1
1 0 2
2 0 4
3 0 8
4 0 0x10
5 0 0x20
6 0 0x40
7 0 0x80
8 1 0
9 2 0
A 4 0
B 8 0
C 0x10 0
D 0x20 0
* 0x40 0
# 0x80 0


Delay library: delay.asm

Finally, you must use this delay.asm library file (similar to code recently distributed in the USART demo sample) that contains a subroutines delay, delay60, and delay1000.
You must add
delay2 subroutine that does what it's name implies.

Program Functionality

Demonstration

You must demonstrate your working program on your board before the lab next week.

Lab Submission (due 11:00pm, Tuesday, January 24, 2012)

For your submission, you need only supply your working, fully commented Lab5.asm, display_dd.asm and rs232_dd.asm files.

Upload your submission through Blackboard (assignment "Lab 6").

Be sure to keep copies of all your files, in case something gets lost.

Grading

Your lab grade will be determined by the following factors:

Program - comments and formatting are important aspects of assembly language programming! And it has to work correctly.

Timeliness of submission as stated in the course policies.