Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
MINI-PROJECT REPORT
TOPICS
LED-DRIVERS
Contents
1 Introduction 2
1.1 Why this project? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 The tools used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Testing 13
3.1 Test cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.2 Simulating: Part of waveform . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.3 Simulating: Transcript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.4 Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4 Conclusion 17
Page 1/17
Computer Science and Engineering CO2034 - Mini Project Report
1 Introduction
Our project implements a system that display the LED lights in different modes and
patterns. The system consists of 17 red LED (LEDR) with specified switches (SWs) for
mode selecting and running speed adjusting.
1.2 Problem
Design and implement a LED-driver with 6 different types and variations (states):
Reset
6 2
5 3
Figure 1: LED-Driver
Where:
• State 1: Two LEDs run (active) from left to right.
• State 4: All LEDs turned on, then turn off LEDs from two sides to the middle.
• State 5: LEDs run from left to right, when all LEDs are active, turn-off the LEDs one
by one from right to left.
• State 6: LEDs run from right to left, when all LEDs are active, turn-off the LEDs one
by one from left to right.
Page 2/17
Computer Science and Engineering CO2034 - Mini Project Report
2. Intel
c
Quartus
c
Prime 17.1 Lite Edition
Page 3/17
Computer Science and Engineering CO2034 - Mini Project Report
Mode 1
7-Segment LED
Mode 2
Clock Divider
Mode 3
LEDR
7-Segment LED
Mode 4
7-Segment LED
This module includes 9 sub-module. The Modes represent each mode that the LED-
Driver has. The Clock Divider create a pulse that has its frequency changed using 4 SWs.
The 7-Segment LED display the current states of each mode. The Mode chooser indicate
what mode will be running using 3 SWs. The LED multiplexer displays the mode’s LED
which was chose by the Mode chooser.
Page 4/17
Computer Science and Engineering CO2034 - Mini Project Report
State 1
State 2
State 3
State 4
State 5
State 6
This module includes 7 sub-module. 6 State modules cycling using Finite State Machine
(FSM) showing their LEDs to the LED chooser to pick and let it show on to the LEDR.
Page 5/17
Computer Science and Engineering CO2034 - Mini Project Report
State 1
State 5
State 2
State 6
These two modules include 4 sub-module. 3 State modules cycling using Finite State
Machine (FSM) showing their LEDs to the LED chooser to pick and let it show on to the
LEDR with cycling order of 1 → 3 → 5 and 2 → 4 → 6 relatively for Mode 2 and Mode 3.
Page 6/17
Computer Science and Engineering CO2034 - Mini Project Report
State 1
State 2
State 3
State 4
State 5
State 6
This module includes 8 sub-module. The States are selected with State Chooser mod-
ules using indicated SWs. Then States’ LEDs then be chosen by the LED Chooser module
to appear on the Mode 4’s LEDR.
Page 7/17
Computer Science and Engineering CO2034 - Mini Project Report
Figure 7: LED Driver RTL model
Main module: LEDDriver
RTL model
2.2
Page 8/17
Computer Science and Engineering CO2034 - Mini Project Report
Figure 8: Mode 1 RTL model
Sub module 1: Mode1
Page 9/17
Computer Science and Engineering CO2034 - Mini Project Report
Figure 9: Mode 2 RTL model
Sub module 2: Mode2
Page 10/17
Computer Science and Engineering CO2034 - Mini Project Report
Figure 10: Mode 3 RTL model
Sub module 3: Mode3
Page 11/17
Computer Science and Engineering CO2034 - Mini Project Report
Figure 11: Mode 4 RTL model
Sub module 4: Mode4
Page 12/17
Computer Science and Engineering CO2034 - Mini Project Report
3 Testing
3.1 Test cases
The test cases are demonstrated as Test bench file below:
`timescale 1ps/1ps
module LEDdriver_tb ();
reg clk;
reg [1:0]mode_sel;
reg [2:0]state_sel;
reg reset;
reg [8:0]sw;
wire [3:0] clock_sel = 4'b1111;
wire [17:0]ledr;
wire [6:0]hex0, hex1, hex2, hex3, hex4;
//[1:0]SW: mode selector,
//[4:2]SW: state selector for mode 4,
//[8:5]SW: Select clock divider
always begin
#5 clk = !clk;
sw = {clock_sel,state_sel,mode_sel};
end
initial begin
$monitor ("led = %b, mode: %b, state in mode4: %b, sm1: %b, sm2: %b, sm3:
%b, sm4: %b", ledr, hex0, state_sel, hex1, hex2, hex3, hex4);
reset = 1;
clk = 0;
mode_sel = 0;
state_sel = 0;
#10 reset = 0;
#10 reset = 1;
#200 mode_sel = 2;
#200 mode_sel = 1;
#200 mode_sel = 3;
#100 state_sel = 1;
$stop;
end
endmodule
Page 13/17
Computer Science and Engineering CO2034 - Mini Project Report
Figure 12: Waveform window
Simulating: Part of waveform
3.2
Page 14/17
Computer Science and Engineering CO2034 - Mini Project Report
Figure 13: Transcript window
Simulating: Transcript
3.3
Page 15/17
Computer Science and Engineering CO2034 - Mini Project Report
3.4 Result
The project’s results:
Page 16/17
Computer Science and Engineering CO2034 - Mini Project Report
4 Conclusion
The design is able to switch and display between different modes (Mode 1 through 4) and
states (Mode 4 exclusively). The speed for displaying the LEDs can be adjusted using 4
SWs [8:5] on the DE2i-150. The 7-segments LEDs indicate which modes and states are
running.
The design’s advantages and disadvantages:
1. Advantages:
- Easy to operate.
- User-friendly interface (kind of).
2. Disadvantages:
- Complex implementation.
Further intention: Will take advantages of using 16x2 LCD display for displaying the info
and maybe will find ways to come up with a more simple states implementation.
Page 17/17