ENSC 151
DIGITAL AND COMPUTER DESIGN LABORATORY

Assignment #2(b): Word Processor

Posted: February 1, 2000
Due: Monday, February 14, 2000, by 16:00 in the ENSC departmental office


Using the current Altera hardware configuration which connects the four push buttons to the /IRQ pin on the HC12 and connects each button to a pin of PORTA, develop an interrupt service routine that prioritizes the button pushes and executes a different command associated with each pushbutton.

The push button functions should be, in order of highest to lowest priority:

  • Clear LCD. Clear all characters from the LCD.
  • Draw a character. Each time the button is pressed a new character should be drawn on the current LCD position, i.e. one can scroll through the whole alphabet and select a character to draw. For simplicity, allow only the standard alphabet in capitals. No special characters. Do not forget the spaces.
  • Move cursor right. When pressed the cursor should move one character to the right.
  • Move cursor left. When pressed, the cursor should move one character to the left.

    Flash the cursor at all times so you know where it is located on the LCD.

    To move from one row to the next, make sure the move left and right functions have the ability to wraparound to the next row of the LCD. If the cursor moves off the left side of the top row, it should reappear at the right side of the bottom row, and vice versa. Same for at the end of the bottom row, it should rotate back up to the left side of the top row. HINT: Recall the size of the LCD that you see, and the actual size of the LCD that the HC12 sees. What are you going to do?

    Recall that there is only one /IRQ pin, and one IRQ service, so your interrupt routine must be able to decode which button has been pushed. Recall that the buttons are connected to PortA.

    Each time you draw a character, start at "A". So, every time you move to a new cursor position, you start scrolling through the characters at "A".

    OPTIONAL: There is a lot of "bounce" on the switches of the Altera board. Make sure that your program is not sensitive to this phenomenon. This problem can be solved by writing a creative algorithm on the HC12 using pauses.

    Marks awarded for efficency of coding and algorithm. Make sure to provide comments in the code.


    Last modified: Saturday February 6 20:56:36 PST 1999.