Experiment 1 - Leds and 7-Segment Display (Part 1) : A. Learning Outcomes
Experiment 1 - Leds and 7-Segment Display (Part 1) : A. Learning Outcomes
A. Learning Outcomes
The table below shows the expected learning outcomes for this activity:
CILO Description
SO1.1 Identify applicable methods and techniques in designing sequential circuits and fundamental
principles of a microcomputer systems.
SO1.5 Formulate methods and solutions using appropriate knowledge in electronics engineering to
design sequential circuits
SO6.2 Analyze and interpret experimental data and results to develop generalizations or
conclusions
SO6.4 Design appropriate experimental procedures or tests, algorithms, methods, and/or process
flow to acquire necessary data for the microprocessor system design.
B. Sample Code
// This code lets the green LEDs blink for every 0.5 seconds where the LEDs are on for a
// half second and off for the next half second.
1. Modify the “counter” value in the given Verilog code. Set your “counter” value to 5.
5 clock cycles
OFF ON OFF ON
E. Instructions
1. Create a new project in Quartus IDE and save it to the working directory.
2. Create a new Verilog HDL file and save it as experiment1A.v.
3. Design a Verilog code such that the delay in change of LED pattern is controlled by switch
SW1. When SW1 set to low logic level, the pattern interval is every 2 clock cycles. When
SW1 set to high logic level, the pattern interval is every 5 clock cycles. The LED pattern is
shown below:
A. Learning Outcomes
The table below shows the expected learning outcomes for this activity:
CILO Description
SO1.1 Identify applicable methods and techniques in designing sequential circuits and fundamental
principles of a microcomputer systems.
SO1.5 Formulate methods and solutions using appropriate knowledge in electronics engineering to
design sequential circuits
SO6.2 Analyze and interpret experimental data and results to develop generalizations or
conclusions
SO6.4 Design appropriate experimental procedures or tests, algorithms, methods, and/or process
flow to acquire necessary data for the microprocessor system design.
B. Sample Code
// This code outputs the counting of numbers from 0 to 9 at half second interval in
// the digital display of the Altera D1SK.
25-31 This block is executed for every positive edge of the clock. First, it checks
whether rst is 0 or key0 is pushed down. If yes, counter is set to low.
If not, the value of the counter is incremented until it reached the
count of 25,000,000.
33-49 This block is also executed for every positive edge of the clock. First, it
checks whether rst is at low state or key0 is pushed down. If yes, the
number “0” is displayed on the 7-segment display. If not, the value of
counter is checked. If the condition is satisfied, that is, if counter is
equal to 25,000,000, a case statement follows wherein the value of
number is checked and a new value of number is assigned, which is
displayed in the active 7-segment LED.
50 It is a reserved word that signifies the end of the Verilog module.
C. Pin Assignment
The assignment of the segments a, b, c, d, e, f, and g will depend on your declaration of
your pin assignments in the TCL script. You can assign the most significant bit (MSB) to
segment ‘a’ and the least significant bit (LSB) to segment ‘g’ or vice versa. In the sample code,
the pin assignment is given below. Note that for simulation purposes, there is no need to
create a TCL Script.
**Repeat the same procedure for declaring pin assignments for 7-segment displays hex2 and
hex3.
1. Modify the “counter” value in the given Verilog code. Set your “counter” value to 5.
2. Add a new University Program VWF.
3. Import all the input and output ports (clk, rst, hex0, hex1, hex2, hex3).
4. Use the following settings:
a. End time: 1000 ns or 1 us
b. Grid size: 10ns
c. Port ‘clk’ value: to “OverwriteClock with period of 10ns, duty cycle 50%”
d. Port ‘rst’ to “Forcing High”
e. Change the radix to Hexadecimal if the binary display is truncated.
5. Run the simulation and check the results.
1. Create a new project in Quartus IDE and save it to the working directory.
2. Create a new Verilog HDL file and save it as experiment1B.v.
3. Design a Verilog code such that it will display the number pattern in HEX0 and HEX1.
Pattern display interval is every 3 clock cycles and returns in a loop:
05 à 10 à 15 à 20
4. Create a simulation waveform (vwf file) with the given setting below. Set the end time to
1us and grid size to 20us. Display the output ports Hex0, Hex1.
a. Waveform 1:
• Clock period is set at 10us, 50% duty cycle
• Reset is at high logic level
b. Waveform 2:
• Clock period is set at 10us, 50% duty cycle
• Reset: Random, every fixed intervals at 200ns