ECE Undergraduate Laboratories
ECE 495 - Computer Engineering Design Laboratory

Lab 4: Clocks and Timers Using LCD Display


The objective of this experiment is to design and implement a few projects that will take advantage of the on-board 50MHz clock. This experiment will be useful in gaining an understanding of how to manipulate the clock for future experiments. In addition, the built-in LCD display will be used for the outputs of the experiment.


Equipment Needed

  • ALTERA DE2 Board



In this experiment, you will design a BCD counter, a clock, and a reflex stop-watch to be output on the LCD display of the Altera DE2 Board. Code is given in appendix 4.1 of this document that will output the message “HELLO WORLD” to the LCD display. Use this code and the user manual to understand how to communicate with the LCD display.

Part 1

Implement a 3-digit BCD counter. Display the contents of the counter on the 7-segment displays, HEX2−0. Derive a control signal, from the 50-MHz clock signal provided on the Altera DE2 board, to increment the contents of the counter at one-second intervals. Use the pushbutton switch KEY0 to reset the counter to 0.

Part 2

Design and implement a circuit on the DE2 board that acts as a time-of-day clock. It should display the hour (from 0 to 23) on the 7-segment displays HEX7−6, the minute (from 0 to 60) on HEX5−4 and the second (from 0 to 60) on HEX3−2. Use the switches SW15−0 to preset the hour and minute parts of the time displayed by the clock.

Part 3

Design and implement on the DE2 board a reaction-timer circuit. The circuit is to operate as follows:

  • The circuit is reset by pressing the pushbutton switch KEY0.
  • After an elapsed time, the red light labeled LEDR0 turns on and a four-digit BCD counter starts counting in intervals of milliseconds. The amount of time in seconds from when the circuit is reset until LEDR0 is turned on is set by switches SW7−0.
  • A person whose reflexes are being tested must press and hold pushbutton KEY3 as quickly as possible to turn the LED off and freeze the counter in its present state. The count which shows the reaction time will be displayed on the LCD display.

Hint: Implement this circuit using the 7-segment displays to output the value of the counter to verify functionality. Then modify the code to output to the LCD.

Prelab Assignment

  1. Using the provided code, understand how to control and communicate with the LCD display.
  2. Develop an algorithm for turning the 50MHz clock into a 1Hz clock to be used for the experiments.

Lab Assignment

Develop VHDL code to implement the designs specified in parts 1, 2, and 3. Be sure to create a separate project for each part and to simulate your circuit to verify functionality. For final demonstration, you should be able to send the BCD counter, the programmable clock, and the reflex stop-watch to the LCD display.