Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Development Platform
Development Manual
(EDA)
1
Diectory
BASIS EXPERIMENT....................................................................................................... 4
2
Preface
In recent years due to the rapid development of VLSI technology and software to
enable the integration of digital systems into a possible integrated circuit, Altera, Xilinx,
AMD and other companies have launched a very good CPLD and FPGA products, and
for those product design with a design, download the software, which supports graphical
design software in addition to digital systems, but also supports a variety of digital
systems design design language, so that a digital system design much easier. In
small-scale digital integrated circuits would phase out today, as an electronic technician
understand project VHDL language and CPLD, FPGA design elements like the use of
The purpose of this guide book is to help readers learn to design digital systems, and
are familiar with the use of Altera's products and software QUARTUS Ⅱ and other
related software.
from simple to design complex digital systems, a detailed description of the various
operating systems and software design methods. Readers can design your own digital
Experiment Subject from simple to complex, so that users can quickly start, while the
experimental guide book can also serve as electronic technology to enhance curriculum
3
Basis Experiment
I. Experiment Object
1、Through a simple one and 3- 8 designs of decoder, know the design
method to make logical circuit up.
3、Know that makes the static method of testing of the logical circuit up.
II. Experiment Theorem
The 3-8 decoder has 3 Input, 8 output. , at N, output end mark output the
high level, say, have the signal produce as input signal for output end of N
according to the intersection of binary scale and person who say of way, but
other level for being low show that there is no signal to produce. Because
three the intersection of association and state that input terminus can produce
have 8, so output end have one under the situation of high level only in each
association, can express all input associations. Their truth tables are shown in
Table 1-1
Input Output
A B C D7 D6 D5 D4 D3 D2 D1 D0
0 0 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 1 0
0 1 0 0 0 0 0 0 1 0 0
0 1 1 0 0 0 0 1 0 0 0
1 0 0 0 0 0 1 0 0 0 0
1 0 1 0 0 1 0 0 0 0 0
4
1 1 0 0 1 0 0 0 0 0 0
1 1 1 1 0 0 0 0 0 0 0
The decoder does not need to point out whether it is effective to export
with an output end like encoder. But can add one into input and can carry to
make to export, is used for pointing out whether to carry on effective decoding
of present input, when can carry to make and instructing the input signal to be
invalid or decoding present signal, output ends are all high level, show that
there is not any signal. It can enable the input terminus to consider in design
of this example, can consider joining and enable being can be at the time of
the input terminus while designing oneself, how does the procedure designs.
decoders are input (A, B, C) ; Show with 8 LEDs 8 of three 8 decoders are exported
(D0-D7) . Observe result and three 8 truth table of decoder that input by
and the intersection of circuit and picture the following of FPGA 1-1 show,
close as switch in the case When it output to levels low,last high level. Its
circuit is connected with pin of the tube of FPGA and shown in Table 1-2
5
Fig 1-1 DIP Switch and FPGA Circuit
LED lights and FPGA interface circuit as shown in Fig 1-2, when the
FPGA and its corresponding port is a high potential LED will light, and
vice versa LED lamp. Corresponding with the FPGA pin connections as shown
in Table 1-3.
6
Fig 1-2 LED and FPGA Circuit
7
1、Create Project File
the user can be set according to their actual situation show as Fig 1-3.
2) Select the software menu File> New Project Wizard, create a new
3)Click NEXT to enter in Fig 1-4 working directory name of the project
settings dialog box as shown in Fig 1-5. The first input box for the
project directory input box, the user can enter e :/ eda work as a path
to set the project directory, set up, all of the generated files will
be placed in the working directory. The second input box for the project
8
name input box, and the third input box to the top-level entity name input
box. Users can set as EXP1, under normal circumstances the project name
and the entity with the same name. Users can also set their own actual
situation.
4)Click NEXT, go to the next Setup dialog box, click on NEXT default
option for component selection dialog box. As shown in Fig 1-6. Here we
9
Depending on the user can use to set the wafer.
First select the top left of the dialog box Family drop-down menu Cyclone Ⅲ,
select 8 in the middle of the right side of the Speed grade drop-down menu in the
lower left of the Available devices box, select EP3C40F780C8, click NEXT to
complete the selected components into the EDA TOOL set the interface as shown in
Fig 1-7.
10
Fig 1-7 EDA TOOL
5)By default options, click New Project NEXT appeared all previous
1)After creating a good design project, select File> New ... menu appears as
shown in Fig 1-9 new design file type selection window. Here we Create Diagram /
Schematic file as an example, with other design entry method is basically the same.
11
Fig 1-9 The New Project Window
2)In the New dialog box, select (Fig 1-9) Block Diagram Device Design Files
page under / Schematic File, click the OK button to open the Graphics Editor dialog
box, as shown in Fig 1-10. Figure marked commonly used functions of each button.
12
Fig 1-10 QUARTUSII Graphics Editor
QUARTUSII graphical editor also called block editor (Block Editor), used in
the form of a circuit diagram (Schematics) and Structure (Block Diagrams) input and
edit graphic design information. QUARTUSII graphics editor can read and compile
the structure of design files (Block Design File) and MAXPLUSII graphic design
files (Graphic Design Files), you can open the file in QUARTUSII graphic design
preference, you can always change the Block Editor display options, such as a guide
wire and grid spacing, rubber band function, color and attributes, such as the basic
3)Here in order to design a thirty-8 decoder with schematic entry, for example,
describes the steps the basic unit symbol input method. In Fig graphics editor
window as shown in the work area 1-10 double-click the left mouse button, or click
on the symbol drawing tool button or select the menu Edit> Insert Symbol ..., then
13
Fig 1-11 Symbol Window
4)Click on the front of the library's "+" sign, expand the library, the user can
select the desired graphics or element, the element is displayed on the right side of
the display element window, the user can enter the name of the component in your
component name you need, click the OK button, the selected element will be
the selected work area graphics editor, with orthogonal node tool components pick up,
and then define the name of the port. In this example, the definition of the three
inputs A, B, C, is defined as the 8 outputs D0, D1, D2, D3, D4, D5, D6, D7. Users
can also according to their own habits to define these pin name called.
6)After completing the input graphics editing, you need to save the design file
or rename the design file. Select File> Save As ... items, dialog box appears as shown
in Fig 1-13, choose a good file storage directory and file name field, enter the name
14
of the design file. If you need to add design files to the current project, the following
dialog box select Add file to current project check box, and click the Save button to
save the file. It should be noted that, throughout the design file is saved in the process,
15
3、Compile Design File
then there QUARTUSII compiler window, as shown in Fig, the figure marked the
It should be noted that during the synthesis and analysis of design files, you can
also open a separate analysis of the consolidation process does not have to be a full
compiler interface. Upon completion of the setting of the window, click the START
button to compile the design of the whole file. If the file is wrong, the software will
prompt at the bottom of the cause and location of the error, which enables users to
modify the design file until no wrong. Entire compilation is complete, the software
4、Pin assignment
16
In front of choosing a suitable target elements (selected for EP3C40F780C8 in
the ad hoc data files, the need for design input and output pins are assigned to a
specific device pin number, specify the pin number is called pin assignment or pin
1)Click the Assignments menu below Assignment Editor, enter the Pin
The first signal pin to be allocated placed below To. To double-click on the
bottom of the "New", as shown in Fig 1-15 interface appears as shown in 1-17 Fig
Select the Node Finder ... enter Node Finder dialog box as shown in Fig 1-18
interface. Fig 1-18 in the example set by parameters. In the Filter window, select Pins:
all, enter "*", click the name of all the signals appear in the Nodes Found List
17
window in the Named window, click button is Selected pin name appears
selected, said bottom Nodes window. Double-click the OK button to complete the
In Fig 1-19 to lock port A pin-for example, the other port pin lock its basically
the same. Select the corresponding port A is Name Assignment let it turn blue,
double-click it, select the drop-down menu appears, as shown in Fig 1-19 Location
18
(Accepts wildcards / groups) option. Select the corresponding port A Value column,
and let it turn blue, according to Table 1-2 and Table hardware and FPGA pin
connections as shown in Table 1-3 (or appendix), enter the corresponding pin name
AH12, press the Enter key, the software will automatically convert it into PIN_AH12,
while the blue selection bar will automatically jump to the next line Value column,
indicating that the software has been assigned to the input port a FPGA-AH12 pick
The same way, in accordance with Table 1-2 and hardware and FPGA pin
connections as shown in Table Table 1-3 (or appendix), on the other port for Pin
2)Click the Assignments menu below Pin Planner (also directly click Pin
19
assignment button on the toolbar) as Fig selected target chip pinout shown in Figure
1-22 appears.
The same way as above, in accordance with Table 1-2 and Table hardware and
FPGA pin connection table (or appendix) as shown in 1-3, as the corresponding
port A pin is AG12, AG12 pin then appear as double-clicking 1-23 dialog box
shown in Fig
Enter the name of the corresponding pin A in Fig 1-23 Node Name dialog box
20
or via the drop-down menu to select the corresponding pin name called A, click the
In the same way, according to the following Table 1-4 for the other port for
21
Table 1-4 Pin assignment
In Fig 1-24, the brown pin marked as having been allocated lock pin. Notably,
when Pin assignment must be then completed a full compile, so that the pin
assignment is valid.
New, conduct new file dialog box. As shown in Fig 1-25. Select dialog Verification
/ Debugging Files tab, select from Vector Waveform File, click the OK button, then
2)Setup end time simulation, simulation waveform editor preset end time
1μS, according to the simulation needs, they can set the simulation end time. Select
QUARTUSII software Edit> End Time command, out of line End Time dialog box
at the end of the input analog Time time, click on the OK button to complete the
setting.
3)Add input and output ports, the waveform editor window to the left of Pin
Name list, click the right mouse button and select Insert from the context menu that
appears in> Insert Node or Bus ... command in the pop Insert Node or Bus dialog
box as Fig Figure 1-27 interface click Node Finder ... button.
22
Fig 1-27 Insert Node or Bus
Node Finder interface appears, as shown in Fig 1-28, in the Filter list, select
Pins: all, enter "*", click on the List the names of all signals in the Nodes Found
window appears, click on the window in the middle of button is selected Pin
Name appears below the Nodes window says. Double-click the OK button to
complete the setting and return to Fig Insert Node or Bus dialog box shown 1-27,
double-click the OK button, all the input and output ports will be displayed in the Pin
23
Fig 1-29 nput the port in the waveform editor
4)Edit input port waveforms, which specifies the input port logic level changes,
as shown in Fig 1-29 waveform editing window, select the input port to the input
waveform such as A port on the left side of the waveform display area Pin Name
According to the simulation needs the input waveform. After completion as shown in
5)Specify the simulator settings, there are timing simulation and functional
24
simulation of the points during the simulation, functional simulation presented here.
Follow the prompts on Fig 1-31, the first to produce functional simulation
netlist file, click on the button Generate Functional Simulation Netlist produce
functional simulation netlist, generating functional simulation netlist, then click the
START button to start the beginning of the simulation to simulate analog progress
until Article 100 percent complete simulation. Click the button to simulate the report
25
Fig 1-32 Simulate Waveform
Completion of the loading element has two forms, one is loading files on the
target elements, one is to configure the chip target elements were loaded. Here we
1) Use USB cable to connect the PC with the experimental system (please refer to
the user manual specifically III USB Blaster installed and used).
window, as shown in Fig 1-33, if the hardware is not set to burn, then burn the
hardware type No Hardware, the hardware needs to be set to burn . Click the
Hardware Setup ... button to set burning hardware, be as shown in Fig 1-34 burning
26
Fig 1-34 Program Hardware Setup
3)Click the Add Hardware button Add Hardware dialog box appears, as shown
in Fig 1-35.
4)In the Add Hardware dialog box, select the Hardware type from the list the
type of hardware needed, if it is USB interface, please refer to the user manual of the
USB Blaster installation and use, if you use a parallel cable is selected as Fig 1-36
type of hardware shown, click on the OK button to complete the set of hardware
types. Back burner hardware settings window, click the Close button to exit. In the
burn dialog box will appear burning hardware just choose the type of burner
hardware.
5)If the software has performed a project, then open the window when burning,
27
burning window will automatically appear in this project file to the file you want to
load the target component, if you want to load other files can be added to change
from other places. After selecting the loaded file, and then click Progam / Configure,
Burn Mode Select JTAG mode, click STRAT for file loading until the loading
V、Experiment Result
After the file is loaded into the target cell, toggle DIP switch, the LED will light
up according to the truth table shown in Table 1-1 correspond. Because after four lights
LED lights module LED9-LED12 is not used, but QUARTUSII software default
settings unused IO is high impedance tri-state, so after four lights LED9-LED12 been
lit.
VI、Experiment Conclusion
1、More familiar with and understand how to use QUARTUSII software.
28
Experiment 2 Gray code encoder VHDL-based design
I. Experiment Object
1、 Understand one yard of principles varied of Grey.
2、 The whole course that operation method and VHDL further familiar
digital system. It features that only there is a different binary number in two
decreasing operation of the number. But Grey whether one have no right yard in
yard, think of the correct and simple one and binary scale yard is changed, must
According to making the logical circuit analytical method up, list its truth
table first and then pass the abbreviation of picture of Kano, it is can very fast
find out on Grey on yard and relations logic between binary scale yard. It
appear ' 1 ', with appearing ' 0 '. That is to say while converting the binary scale
yard to Grey yard, the high position is all the same, the Grey still ' 0 ' in yard,
adjacent two the intersection of binary scale and " different " of yard totally " the
29
Fig 2-1 Schematic drawing of the Gray code transformation
III.Experiment Subject
This experiment requires the task finished is that binary scale yard which
varies 12 to yard. Show in the experiment 12 binary scale are input by 8 K1-
K12 which stir the module of switches, show yard of 12 Grey of experimental
result changed with LED1- LED12 of LED module. The experiment LED shows
the corresponding location is that ' 1 ', it shows the corresponding location is
that ' 0 ' that LED kills bright. Result and conversion in the the intersection of
experiment and principle input to observe identical in rule by inputting different
values. Interface circuit which stirs switch, and FPGA in the experiment case, it
is made in the experiment one that LEDis connected with interface circuit and
stiring switch, LED with the pin of the tube of FPGA of FPGA to explain in detail,
are not going into details here.
2、 After finishing building the project, newly build another VHDL File. Newly
30
Fig 2-2 New VHDL File
2)In New communication frame ' Fig 2-2) China chooses VHDL File
under Device Design Files page, clicks OK button, turns on VHDL editing
program edit window, the user can refer to the example provided in the program
CD.
4、 After you have written VHDL program storage. Approach with the experimental
one.
5、 Compile and program for VHDL simulation, modify the program for errors.
6、 After compiling simulation is correct, according to the DIP switch, LED and
FPGA pin connection table (Table 1-1, Table 1-2) or a reference in Appendix Pin
31
assignment, Table 2-1 is an example of the program's Pin assignment table. After
the assignment is complete, and then compile a whole, so Pin assignment to take
effect.
D1 LED1 Pin_AE8
D2 LED2 Pin_J22
D3 LED3 Pin_M24
D4 LED4 Pin_L24
D5 LED5 Pin_L23
D6 LED6 Pin_H23 Gegere coding
D7 LED7 Pin_H24 encoder output
D8 LED8 Pin_F24
D9 LED9 Pin_E24
D10 LED10 Pin_F22
D11 LED11 Pin_E22
D12 LED12 Pin_F21
32
Table 2-1 Pin assignment
7、 Download sof file is loaded into the FPGA via JTAG. Observed experimental
V. Experiment Result
In reference to the example design, for example, when the design file
is loaded into the target cell, toggle DIP switch, LED will follow
33
Experiment 3 Zero with asynchronous and synchronous
enable the addition of counter
I. Experiment Object
1、 To understand the binary counter works.
2、 More familiar with the use of methods and VHDL input QUARTUSII
software.
with asynchronous and synchronous zero enable the addition of specific work
In the case of the rising edge of the clock, enable detection of whether the
enable end) then start counting, otherwise enable end signal has been detected. In
the process of re-counting the reset signal is detected asserted (active low), the reset
signal when the function, the count value of zero, proceed detected and counted.
34
III.Experiment Subject
The experiment required to complete the task in the role of the clock signal, via
the enable terminal and a reset signal to the counter to complete the addition.
Experiments using a digital clock signal source module 1Hz clock signal with a million
DIP Switch K1 represents enable end signal, said reset signal to reset the switch S1,
with the LED module LED1 ~ LED11 to represent two counts carry results.
Experimental LED light indicates the corresponding bit is '1 ', LED off indicates that
the corresponding bit is '0'. By entering different values simulated counter timing data,
observations count. Experimental tank DIP switch, and FPGA interface circuits, LED
lights and FPGA interface circuit and DIP switches, LED and FPGA pin connections
are made in the experiment described in detail, not repeat them here.
Table 3-1 is its clock output and FPGA pin connection table.
Table 3-1 is its clock output and FPGA pin connection table.
35
Fig 3-3 Key switch module circuit schematic
Table 3-2 Key switch and the FPGA pin connection table
open VHDL Editor dialog box. According Experiment Theorem and their
36
ideas in writing VHDL VHDL program edit window, the user can refer to the
3、 After finish writing VHDL program storage. Approach with the experimental
one.
5、compiled simulation is correct, according to the DIP switch, LED and FPGA
pin connection table(Table 1-1、Table 1-2)Or reference in Appendix Pin
effect.
Pin Name Module Signal FPGA IO Description
CLK Digital signal Pin_T2 Clock is 1Hz
EN DIP Switch K1 Pin_W6 Enable signal
RET Key switch S1 Pin_B12 Reset Signal
CQ0 LED1 Pin_V10
37
6、 with the corresponding burner download sof file is loaded into the FPGA via
V. Experiment Result
In reference to the example design, for example, when the design file
is loaded into the target cell, the clock select digital signal source is
1Hz, so DIP Switch K1 is set to a high potential (DIP switch allows up),
four bit LED will follow the Experiment Theorem is lit in sequence, when
applied to the adder 9, LED12 (into the bit signal) is lit. When the reset
button (key switch S1 key) is pressed, the count is zero. If DIP Switch
K1 is set to a low potential (DIP switch down) the adder does not work.
4、 Hanging the clock frequency, the experiment to see what will change
38
Experiment 4 8 x 7-Seg LED Dynamic Display Circuit
Design
I. Experiment Object
1、 To understand the working principle of the 7-Seg LED .
output display device. Used in the experimental system is one of two four bit, 7-Seg LED
common cathode type. Its single static segment display as shown in Figure 4-1.
As the 7-Seg LED common terminal connected to GND (common cathode type),
when that one segment of the 7-Seg LED is the high potential, the corresponding
section is lit it. On the other hand is not bright. Four bit in a single one of the 7-Seg LED
on the basis of the static segment display added bit select signal port is used to select
7-Seg LED are selected by the respective bit signals to control, selected seven segment
III.Experiment Subject
The experiment required to complete the task in the role of the clock signal input
39
through the key displays the corresponding key on the 7-Seg LED . In the experiment,
the digital clock is selected as the scan clock 1KHz, with four DIP switches as input,
when the four DIP switches set to a binary number, which displays the hexadecimal
value of the 7-Seg LED . Experimental tank DIP switch interface circuit and FPGA,
FPGA's and DIP switch pin connections are made in the experiment described in detail,
in Table 4-1 is its 7-Seg LED with the FPGA input pin connection table.
40
SEL[1] Pin_P17 JP2_30
SEL[2] Pin_R16 JP2_29
program edit window, the user can refer to the example provided in the program
CD.
4、 After finish writing VHDL program storage, approach with the Experimental 1.
5、 To compile and simulate VHDL program, and modify the program for errors.
6、 Compiled simulation is correct, according to the DIP switch, 7-Seg LED with
the FPGA pin connection table (Table 1-1, Table 4-1) or a reference in Appendix
Pin assignment. Table 4-2 is an example of the program's Pin assignment table.
After the assignment is complete, and then compile a whole, so Pin assignment
to take effect.
41
LEDAG4 7-Seg LED E Pin_P16
7、 With the corresponding burner download sof file is loaded into the FPGA via
JTAG. Observed if the experimental results are consistent with their programs.
V. Experiment Result
In reference to the example design, for example, when the design file is loaded into
the target cell, the digital signal is selected as the clock source module 1KHz, four
million toggle DIP switch, it is a value, then 8 Seven-segment DIP switch display
2、 shows how the scan clock is working, what happens to change the scan
clock.
42
Experiment 5 NC divider design
I. Experiment Object
1、 NC divider learning design, analysis and testing methods.
III.Experiment Subject
The experiment required to complete the task in the role of the clock signal
through the input octet DIP switch input different data, changing the division ratio, the
output port output clock signals of different frequencies, to divide the numerical
results. In the experiment, the digital clock selection 1KHz as the clock signal input
(too frequently observed LED flashing speed), with 12 DIP switches as input data,
when 12 DIP switch is set to a binary number when , the clock signal at the output
port of the corresponding output frequency, the user can change the signal with an
oscilloscope connected to the output module observed frequency. You can also make
the output port connected to LED lights to observe the changes in frequency. In this
experiment we enter the access LED light module. Experimental tank DIP switch,
LED and FPGA interface circuits, and DIP switch, LED and FPGA pin connections
are made in the experiment described in detail, not repeat them here.
43
3、 According to Experiment Theorem and their ideas in writing VHDL VHDL
program edit window, the user can refer to the example provided in the program
CD.
4、 after finishing writing VHDL program storage, approach with the experimental
one.
5、 To compile and simulate VHDL program, modify the program for errors.
6、 compiled simulation is correct, according to the DIP switch, LED and FPGA pin
After the assignment is complete, and then compile a whole, so Pin assignment
to take effect.
44
Table 5-1 Pin assignment
7、 With the corresponding burner download sof file is loaded into the FPGA via
V. Experiment Result
In reference to the example design, for example, when the design file
is loaded into the target cell, the digital signal is selected as the clock
source module 1KHz, DIP switch toggle octet, it is a value, then the input
clock signal makes LED lights start flashing, changing DIP switch, LED
illustration.
2、On the basis of this program is to expand into a 16-bit divider, write
VHDL code.
45
Experiment 6 Graphics and VHDL mixed input Circuit
Design
I. Experiment Object
1、 To learn module generates files in the calling component QUARTUSII
software.
2、 master the rules and methods of connection module component and module
components.
generate a modular component file as its calling function modules element at the top of
the graphic design elements like any other file in the same macro functional elements
level design can be called repeatedly. The experiment Experiment Theorem is to design
experiments in front of three, four, five through QUARTUSII design software combined
into one file. Experimental realization of three, four, Fifth of all functions.
five Experiment Subject basically the same. In the experiment, the clock signal
selection 1KHz as 7-Seg LED of the scan clock, DIP switch input a preset 12-bit, after
NC divider circuit (test five) after crossover to get a lower frequency as addition
counter (experiment III) clock frequency counter adder. Values obtained for the 7-Seg
LED decoder circuit (Experiment IV) displayed on the 7-Seg LED. Experimental box
in digital clock module, thumbwheel switch, key switch, 7-Seg LED, LED and FPGA
interface circuits, and DIP switch, key switch, 7-Seg LED, LED and FPGA pin
connections in Experiment 3 Fourth, Fifth done a detailed description, not repeat them
46
here.
3、 Select File> Open command, shown in Figure 6-1, opens copied to the
program.
4、 In the File menu, select Create / Update item, and then select Create
Symbol for Current File, click the OK button, you can create a design
element just open file functions (. Bsf) on behalf of, shown as Fig
6-2. If the file corresponding component file has been created before,
then perform the operation tooltip will pop up and asks whether you
want to overwrite the existing component file. The user can choose
47
Fig 6-2 Create a Module Component Files From the Current File
files, open the Graphics Editor dialog box. In the graphic editor window,
double-click the left mouse button work area, or click on the symbol
drawing tool button or select the menu Edit> Insert Symbol ..., then
48
Fig 6-3 Symbol Symbol Dialog Box
7、 In the Symbol dialog box Project item (Fig 6-3) will be established
in front of the module component file (EXP3, EXP4, EXP5), we can now
8、 Select the module component files placed into the workspace, later transferred to
the module components needed to connect between symbols, as well as placing the
because the input data takes up 12 bit a DIP switch, so as to synchronize the enable
signal EN end we added a VCC signal to the enable signal EN effective end. After
9、 On this own graphic symbol input file written program for storage, then compile
10、 Compiled simulation is correct, according to the DIP switch, LED and FPGA
pin connection table (Table 1-1, Table 1-2) or a reference in Appendix Pin
assignment. Table 6-1 is an example of the program's Pin assignment table. After
the assignment is complete, and then compile a whole, so Pin assignment to take
effect.
49
DATA0 DIP Switch K1 Pin_W6
11、 With the corresponding burner download sof file is loaded into the FPGA via
50
V. Experiment Result
In reference to the example design, for example, when the design file
is loaded into the target cell, the digital signal is selected as the clock
source module 1KHz, struck 12 bit DIP switch to a value, and the 8 7-Seg
LED according to a certain rate began to show "0-F", When 7-Seg LED to
display AF LED1 began to be lit, the display turns off when other values
. Press S1 button to display the values 0 and from the beginning, toggle
octet DIP switch, put the additional information, the display rate 7-Seg
2、 To own design file, and then through the design files to the converter
module component files, design your own circuit and verify the
51
Experiment 7 Variable step subtraction counter design
I. Experiment Object
1. Deepen their understanding of the counter.
components, it changes every time either plus 1 or minus 1, therefore, we say this is a
step counter.
n many applications, all hope of the counter variable step size. The so-called
variable step size, the step counter is a fixed value, the specific number depends on the
outside intervention. For example, given its external step is 5, then the counter each
time either plus 5, or minus 5, meaning that every time you change the amount of
counter 5. This step counter variable only has a certain practical significance, such as
the address of the accumulator in DDSF is a step increments the counter variable.
the amount requested from 0-15 variable in the design using DIP switches K1-K4 as a
step change in the amount of inputs used to control K12 counter subtraction. Specific
requirements: K12 input is high when the potential, the counter increments the variable
counter adder; K12 when input is low, the counter is a down counter variable step size.
The output of the counter with 12 LED lights to indicate its binary code. Experiments
in order to counter it with a clock frequency of 1Hz clock as observed with frequency
stepping. Experimental box in digital clock module, DIP switch, LED and FPGA
interface circuits, and digital clock source, DIP switch, LED and FPGA pin connections
in previous experiments have done a detailed description, not repeat them here.
52
1、 open QUARTUSII software, create a new project.
program edit window, the user can refer to the example provided in the
program CD.
experimental one.
5、 To compile and simulate VHDL program, modify the program for errors.
LED lights and FPGA pin connection table or reference in Appendix Pin
53
COUNT5 LED D6 Pin_V11
7、 with the corresponding burner download sof file is loaded into the FPGA via
V. Experiment Result
In reference to the example design, for example, when the design file is loaded into
the target cell, the digital signal is selected as the clock source module 1Hz, toggle
DIP Switch K1-K4, enter a four-element data as a variable the step length was
observed LED lamp 12 is not changing by performing the subtraction step variable.
Slide DIP Switch K12 LED is switched observed not by design ideas during the
multiplier.
3、 on the basis of this program, with 7-Seg LED to show the result is
recorded.
54
Experiment 8 4-Bits Parallel multiplier design
I. Experiment Object
1、 To understand four-bits Paralled multiplier.
basically divided into two categories, one is to rely on a combination of logic circuit,
and the other pipeline implementation. The biggest advantage of parallel multiplier
pipeline structure is fast, especially in the continuous input multiplier, but you can
achieve near-cycle operation speed, but to implement than the combinational logic
multiplying the lowest S1, then the left one and then A 2 B bit obtained by multiplying
S2, then A left 3 and B is obtained by multiplying the third S3, and so on, until all the
bits B are finished by far, and then the multiplied results S1, S2, S3 ...... i.e., obtained
It should be noted that the implementation of the multiplier to multiply is not real,
but to achieve a simple judgment, give a simple example. If A is multiplied with the left
bit first n bits B n, if the B is '1 ', then the result of the multiplication intermediate result
is shifted left by n bits after the A, B, if this is otherwise' 0 ', then multiplying the result
directly in the middle is 0. After all bits are multiplied with the B end, the sum of all the
55
multiplicand A DIP switch module with K1 ~ K4 expressed multiplier B is represented
LED light indicates that the corresponding bit is '1 '. Select 1KHz scan clock signal as
the clock, enter a four-digit DIP switch element multiplicand and a four multiplier
circuit has been designed after the information is obtained by multiplying displayed on
the LED lights. Experimental box in digital clock module, DIP switch, LED and FPGA
interface circuits, and digital clock source, DIP switch, LED and FPGA pin connections
in previous experiments have done a detailed description, not repeat them here.
3. Follow Experiment Theorem and their ideas in writing VHDL VHDL program
edit window, the user can refer to the example provided in the program CD.
4. having written VHDL program storage, approach with the experimental one.
lights and FPGA pin connection table or reference in Appendix Pin assignment.
Table 7-1 is an example of the program's Pin assignment table. After the
effect.
Pin Name Module Signal FPGA IO Description
CLK Digital signal Pin_T2 Clock is 1KHz
A0 DIP Switch K4 Pin_W6
A1 DIP Switch K3 Pin_Y4 Multiplicand
A2 DIP Switch K2 Pin_U7 data
A3 DIP Switch K1 Pin_V3
B0 DIP Switch K10 Pin_V7 Multiplier Data
56
B1 DIP Switch K9 Pin_V6
B2 DIP Switch K8 Pin_R5
B3 DIP Switch K7 Pin_T5
COUT0 LED12 Pin_Y6
COUT1 LED11 Pin_Y7
COUT2 LED10 Pin_W7
COUT3 LED9 Pin_Y8
COUT4 LED8 Pin_W13
Two
COUT5 LED7 Pin_W14
multiplication
COUT6 LED6 Pin_V11
result output
COUT7 LED5 Pin_Y13
COUT8 LED4 Pin_Y10
COUT9 LED3 Pin_W10
COUT10 LED2 Pin_W8
COUT11 LED1 Pin_V10
loaded into the FPGA. Observed experimental results are consistent with
their programs.
V. Experiment Result
In reference to the example design, for example, when the design file is loaded into
the target cell, the digital signal is selected as the clock source module 1KHz, toggle
displays the result of multiplying the two values of binary digits in the LED lamp.
57
2. Design a 8-bits parallel multiplier on the basis of this
program.
3. On the basis of this program, and with the 7-Seg LED to show
results recorded.
58
Experiment 9 4-Bits Full adder Design
I、 Experiment Object
1、 To understand the basis of Four-Bits full adder.
carry Ci-1 as input, and generates the high-Si-based, and the logic circuit
into the bit Ci. It is not only to complete the standard binary sum of Xi
and Yi, but also take into account the lower one into the bit Ci-1 logic.
For input Xi, Yi, and Ci-1, for the case of Si and Ci output, you can get
full adder according to the law of the binary adder truth table as shown
in Table 9-1:
Xi Yi Ci-1 Si Ci
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 0 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
Obtained from the truth table after Si and Ci logical expressions through
simplified as:
59
This is just one-bit binary full adder, to complete a four-bits binary full adder, just
K7 ~ K10 as another addend Y input on the experimental system, with LED module
LED1 ~ LED12 output as a result of S, LED light indicates output '1 ', LED off means
output '0'.
Experimental tank DIP switch, LED and FPGA interface circuits, and DIP
switch, LED and FPGA pin connections in previous experiments have done a
3. Follow Experiment Theorem and their ideas in writing VHDL VHDL program
edit window, the user can refer to the example provided in the program CD.
4. After you have written VHDL program storage. Approach with the
experimental one.
5. For I have written and compiled VHDL simulation program, modify the
60
assignment to take effect.
7. by downloading via JTAG programmer sof the corresponding file is loaded into
the FPGA. Observed experimental results are consistent with their programs.
V. Experiment Result
In reference to the example design, for example, when the design file is loaded into
61
the target cell, toggle the appropriate DIP switch, enter two four per addend, then
displays the results in the sum of these two values on the LED lights binary digits.
illustration.
3. With 7-Seg LED to show the results of multiplying the decimal value.
62
Experiment 10 Design of Controllable Pulse Generator
I. Experiment Object
1、 To understand the principle controllable pulse generator.
to produce a variable duty cycle and pulse waveform. The principle controllable pulse
generator is relatively simple and can be simply understood as a counter input clock
signal dividing process. By changing the upper limit value of the counter to the
purpose of changing the cycle by changing the potential of the inverted threshold value
to achieve the purpose of changing the duty cycle. Here Here is a simple example to
f there is a counter clock frequency T, the count range from 0 ~ N, the other to
take a
changing the value of N can change the period of the output pulse; changing the value M,
1 0T M
Q
0 M T N
required output and duty cycle pulse wave can be changed. Specific experiment, the
63
clock signal selection of 1MHz clock clock module, and then use the keys S1 and S7
modules to control the cycle of the pulse wave, every press S1, N will continue to
increment at a slow clocked 1 press S7, N constantly diminishing role in the slow clock
1; using S2 and S8 to control the duty cycle of the pulse wave, every press S2, M will
continue to increment in the role of a slow clock, each press S8, M will continue to
decrement a role in the slow clock, S12 is used as a reset signal when you press the
S12, the reset pulse generator inside the FPGA module. The output pulse output
directly to the observed experimental box probe module to change the output with an
oscilloscope waveform.
program edit window, the user can refer to the example provided in the program CD.
4、 after finish writing VHDL program storage. Approach with the experimental one.
5、 for I have written to compile and simulate VHDL program, modify the program
for errors.
6、 compiled simulation is correct, according to the DIP switch, LED and FPGA pin
connection table (Table 1-1, Table 1-2) or a reference in Appendix Pin assignment.
Table 10-1 is an example of the program's Pin assignment table. After the assignment
64
ND Key switch S7 Frequency control /
Pin_A12
reduce
MU Key switch S2 Duty cycle control /
Pin_B11
increase
7、 , with the corresponding burner download sof file is loaded into the FPGA via
is loaded into the target cell, the digital signal is selected as the clock
source module 1MHz, press the button switch module S12 keys may observation
changed so that the program does not affect the duty cycle changes.
65
results of the analog waveform hardware and test results recorded.
66
Experiment 11 Flip-Flop Design
I. Experiment Object
1. To understand the basic trigger works.
2. To be more familiar with the Quartus II design flow based on circuit diagram.
anti-and gates can also be cross-coupled gates by two trans or composition. Now to the
B B
4 5
6 Q 4 Q
R 5 S 6
For example, to analyze how it works. According to the relationship with the
non-logical, you can get the state triggers the transfer of basic and simplified truth table
truth table, as shown in Table 11-1:
State transition truth table Simplify the truth table
R S Qn Q n1 R S Q n1
0 1 0 0 0 1 0
0 1 1 0 1 0 1
1 0 0 1 1 1 Qn
1 0 1 1 0 0 NC
1 1 0 0
67
1 1 1 1
0 0 0 NC
0 0 1 NC
III.Experiment Subject
The experimental task is to use schematic entry Quartus II software, resulting in a
basic flip-flop, flip-flop can be in the form of anti-and gate structures, but also can
counter or gate structure. K1 and K3 experiments used to denote key module R and S,
respectively, Q and with LED12 LED modules and LED1. In the case of R and S
Experimental tank DIP switch, LED and FPGA interface circuits, and DIP
switch, LED and FPGA pin connections in previous experiments have done a
IV.Experiment Step
1. Open QUARTUSII software, create a new project.
element input file, open the graphic elements Editor dialog box.
program elements editing window, the user can refer to the example
4. Circuit design is good design program, the saved. Approach with the
experimental one.
5. For I have written a program designed to compile and simulate the circuit for
68
programming errors to be modified.
effect.
Q LED12 Pin_Y6
NQ LED1 Pin_V10
into the FPGA. Observed experimental results are consistent with their
programs.
V.Experiment Result
In reference to the example design, for example, when the design file is loaded into
the target cell, toggle the appropriate DIP switch (ie, R, S), then through the bright
LED lights on and off to show the results of the trigger input. The input and output,
and Table 8-1 basic trigger state transition truth table compares watch are the same.
flip-flop.
69
Application of the Experimental Section
I. Experiment Object
1、 to understand ordinary 4 × 4 keyboard scanning principle
realize the keyboard scan; Then use the software to realize the keyboard scan. As an
embedded system designers will always be concerned about the cost of the product.
There are a lot of chips can be used for keyboard scanning, but the software keyboard
requires very little CPU resources. Feature embedded controller, and can take
control.
circuit shown in Figure 10-1, the microprocessor can be easily detected off. When the
switch is open, through a pull-up resistor processor I / O logic 1 on offer; When the
70
switch is turned off, the processor / IO input will be pulled down to get a logic 0. May
Unfortunately, the switch is not perfect, because when they are pressed or released, is
not able to produce a clear 1 or 0. Although the contact points may appear stable and
quickly closed, but with a fast microprocessor execution speed, this action is relatively
slow. When the contact closes, it bounced like a ball. As shown in the pop-up effect
will produce several of Fig12-2 pulse. The duration of the bounce is usually
maintained between 5ms ~ 30ms. If you need more keys, each switch can be connected
to the microprocessor input port of its own. However, when increasing the number of
switches, this method will soon use up all the input ports.
The most effective way switch array keyboard (or more if needed key 5) is
formed as shown in Fig12-3 a two-dimensional matrix. When the number of rows and
columns, like a long time, which is a square matrix, will produce an optimal way the
cloth out (I / O terminal is connected to the time). A transient contact switch (button)
71
The number of keys required matrix obviously varies depending on the
application. Each line consists of a driver of an output port, and each column of a
keyboard, usually connected to four rows, four, so to identify the key only
needs to know which rows and columns which can, in order to complete the
identification process, the idea is , the first four fixed output high level
behavior, as the low potential and the output 4, the output value is read
in four rows, the high potential would typically be pulled low, if the read
otherwise, if there is to read four lines into a low potential, then the
to the line value keys. Similarly, access column values, too, the first
read into the column values, what if there was a low potential, then
matched to each button, find the key after displaying the 7-Seg LED.
pressing keys on the 4X4 matrix keyboard keys to read and complete certain functions
(such as mobile, etc.) in the 7-Seg LED to display. By definition of the keyboard,
press the "*" key in the 7-Seg LED is a display "E" key. Press the "#" key to display
the "F" key on the 7-Seg LED. Other key press on the keyboard to display logo.
In this experiment 7-Seg LED circuit and connecting with FPGA pin connections
72
in previous experiments have done a detailed description, not repeat them here. 4X4
matrix circuit schematic of the experimental box on the keyboard as shown in Fig12-4.
VHDL program edit window, the user can refer to the example provided in
73
the program CD.
experimental one.
5、 To compile and simulate VHDL program, modify the program for errors.
7-Seg LED with the FPGA pin connection table (table or reference in
74
G 7-Seg LED module G Pin_R14
7、 With the corresponding burner download sof file is loaded into the FPGA
programs.
is loaded into the target cell, the digital signal is selected as the
clock source module 1KHz, press one key matrix keyboard, the display
pressed again before the second key when a key value in the 7-Seg LED
left. Press "*" key in the 7-Seg LED is displayed "E" key. Press the "#"
illustration.
75
results of the analog waveform hardware and test results recorded.
76
Experiment 13 16x16 Matrix LED Experiment
I. Experiment Object
1、 For dot matrix character generator and 16 * 16 dot matrix display
working principle and the principle of the system.
2、 To strengthen the bus generated addresses positioning CPLD achieve
understanding methods.
3、 The master calls the use of the ROM in the FPGA.
II. Experiment Theorem
This experiment is completed Chinese characters displayed on the LED,
16 * 16 LED dot matrix scanning works similar to the 8 bit scanning 7-Seg
LED, and display the results just not the same. Here's the principle of
instructions.
From the above chart we can see that when the circuit diagram of a single LED Rn
enter a high potential, while Cn input is a low potential to form a loop circuit, LED light.
That is the point corresponding LED dot is lit. 16 * 16 dot matrix is composed of 16 rows
and 16 of the LED, in which all 16 LED's Rn parallel with the end of each line, Cn all 16
LED's in parallel with the end of each column. Rn through to enter a high potential, it is
equivalent to the list of all the LED entered a high potential, then as long as a low-end entry
Cn certain LED's potential, the corresponding LED will be lit. Specific circuit as shown in
Figure 13-2:
77
Fig 13-2 16 * 16 matrix circuit schematics
There must be displayed on the dot matrix character is based on the point of his
character dot matrix display light off as shown in Figure 13-3 expressed:
bit will be "Chinese" character of the area covered by bright, will appear
according to the previous display. When we select the first column, the
point needs to be lit Rn is set to a high level, then the first column will
the second row, third column of the N columns ...... points need to be lit.
Interval point and then according to the visual principles of the human
eye, each column will be set to display a certain value, then we will feel
a complete display flicker characters. You can also follow this principle
78
characters required timing diagram:
In the figure above, the role of the clock in the system, first select
one of the columns, the columns of data entry so that the LED display its
data (when the LED light is high potential, otherwise not shine). Then
select the next column to display the data of the next column. When finished
after a 16 * 16 dot matrix data entry, select that column count to the last
column, and then began to enter the same data from the first column. So
long as the first row of data shows the first and second display time of
the first row of data is short enough, then the human eye will see the first
row of data is always displayed without pause phenomenon. The same is true
octets of data to form, then you want to display multiple characters, these
data can be stored in accordance with certain rules into memory, when the
not put the memory, but in the program directly into a 16-bit data
79
Fig 13-5 Font file format
control through the program. Achieve repeat "Welcome embedded SOC development
6 * 16 dot matrix circuit principle has already been done in the detailed
into account the relationship between the LED current power and current
consumption of FPGA adding the drive circuit in the experimental circuit. Specific
circuit as shown in Figure 13-6. Connection as shown in Table 13-1 and FPGA pin.
80
DOT_R[0] Pin_T16 JP2_28
DOT_R[1] Pin_R17 JP2_27
DOT_R[2] Pin_T17 JP2_26
DOT_R[3] Pin_T15 JP2_25
DOT_R[4] Pin_M7 JP1_32
DOT_R[5] Pin_G11 JP2_23
DOT_R[6] Pin_T14 JP2_14
Dot array Row
DOT_R[7] Pin_T12 JP2_13
DOT_R[8] Pin_T11 JP2_12
DOT_R[9] Pin_T10 JP2_11 Data
program edit window, the user can refer to the example provided in the program CD.
4、
81
Fig 13-7 16*16 matrix display circuit block diagram
5、 After finish writing VHDL program storage. Approach with the experimental
one.
6、 for I have written to compile and simulate VHDL program, modify the program
for errors.
7、 compiled simulation is correct, according to the lattice, the clock and the FPGA
sample program in the experimental system Pin assignment table. After the
assignment is complete, and then compile a whole, so Pin assignment to take effect.
8、 with the corresponding burner download sof file is loaded into the FPGA via
is loaded into the target cell, the digital signal is selected as the clock
source module 1KHz, followed by the dot matrix display module loop "Welcome
0.5 seconds. Time last displayed about 2 seconds, then reappears, "Welcome
82
to the SOC development of embedded systems."
on the dot.
2、 Thinking how to make the Chinese characters rotate and move around.
3、 Dry to take advantage of the FPGA ROM font file into the ROM, and then
83
Experiment 14 DC Motor Speed Test
I. Experiment Object
1、 The master works of DC motor.
in Figure 14-1:
power supply is turned on through the brushes of the armature winding, the armature
current flowing through the conductors, due to electromagnetic action, so that the
armature conductor will generate a magnetic field. While the magnetic field and the
magnetic field generated by the main magnetic pole generates electromagnetic force,
the electromagnetic force for the rotor, the rotor starts to rotate at a constant speed.
84
Such motors began to work.
the external circuit of the motor while the rotor wheel electronics
enables adding a Hall Seoul original output generated magnetic field with
magnetic steel sheets. When the motor rotates, the rotary drive plate
rotate together with the magnet when the magnet is rotated to the top
sheet of the Hall element, the output of the Hall element can lead to
a high potential to low potential. When the magnet piece turned Hall above
Such motor rotates every week, then the output of the Hall element will
generate a low pulse, we can detect by the number of components per unit
the unit time. DC motors and circuit switching circuit diagram Hall
85
Usually refers to the motor speed of the motor rotation speed per minute, is in
units of rpm, the actual measuring procedure in order to reduce the speed of the
seconds, then the equivalent of only records the number of revolutions of the motor
Finally, because the data is displayed in the data multiplied by 10, which is
followed by a bit of information will add an element to be a bit then, this one will
always be 0. Such as: 45 * 10 becomes 450, that is, the "45" after the addition of a
bit "0." It can be seen, the error of the motor rotation speed is less than 20. To make
the information can be displayed stable at 7-Seg LED, the output of this information
when adding a 16-bit latch, the latch data to the 7-Seg LED to display, so that it will
because in the counting process, the data changes resulting 7-Seg LED to display
constantly changing.
reads the motor rpm, and displayed on the 7-Seg LED. It reads the data and display
86
In this experiment 7-Seg LED circuit and connecting with FPGA pin connections
in previous experiments have done a detailed description, not repeat them here. DC
motors and circuit schematic of the Hall element, such as Fig 14-2 shows. Connection
Table 14-1 DC motor, the Hall element and the FPGA pin connection table
program edit window, the user can refer to the example provided in the
program CD. Providing a total of four sample program VHDL source code.
16-bit latch, the latch control signal in effect, the count value
SEG32B.VHD
latched
87
4、 after finish writing VHDL program storage. Approach with the
experimental one.
modify the program, and ultimately all programs produced by the compiler
VI.
6、 create a graphics file editor, modular component file into which would have
in Fig 14-4:
element, 7-Seg LED with the FPGA pin connections table or reference in
88
whole, so Pin assignment to take effect.
9、 with the corresponding burner download sof file is loaded into the FPGA
via JTAG. Observed experimental results are consistent with their program.
is loaded into the target cell, the digital signal is selected as the
clock source module 1MHz, the DC motor module mode selector to GND mode,
to rotate, this time in a certain period of time, 7-Seg LED will display
the rpm of the motor current at this time. Slowly increase by reducing
89
the value of 7-Seg LED will be a corresponding increase or decrease.
to bits.
90
Experiment 15 Stepper Motor Drive Control
I. Experiment Object
1. Understand the working principles of the stepper motor.
3. To control the stepper motor rotates the entire process with FPGA.
instrumentation, such mechanical means can accurately control the rotation angle of
the mechanical device, the moving distance and the like. You can also use a stepper
motor driven screw potentiometer to adjust the voltage or power, in order to achieve
control of the executive machinery. Stepper motor can be driven directly with a digital
signal, very convenient to use. Stepper motor also has a quick start, stop, and
positioning precision stepper characteristics, which are widely used in CNC machine
As can be seen from the figure, the stator of the motor has six poles aliquots, A, A
', B, B', C, C ', the angle between two adjacent magnetic poles is 60 °, two opposite
form a group of magnetic poles (A-A ', B-B', C-C '), when a current through the
91
windings, the windings of the respective two poles N and S poles are formed on each
magnetic pole have five small rectangular teeth are distributed, there is a small
rectangular teeth 40 uniformly distributed around the circumference between two
corresponding to the magnetic poles, and with a certain angle of rotation of the rotor,
the rotor and stator teeth are mutually aligned. Thus, the wrong tooth is to promote the
B, C phase is not energized, the magnetic field in the rotor and the stator teeth of phase
A tooth alignment, we as the initial state. A centerline of the magnetic pole provided
with teeth of the aligned rotor teeth number 0, the A-phase and B-phase magnetic poles
away not an integer multiple of 9 °, with 120 ° (120 ÷ 9 = 13 2/3), so in this case the
rotor tooth There are no B-phase stator teeth corresponding to only a small number of
teeth near the centerline 13 of the B-phase poles, away from the center line 3 °, then
suddenly changed if the B-phase power, A, C phase is not energized, the B phase
forcing the 13th pole rotor teeth are aligned with the rotor rotates 3 °, so that the motor
⑵Running speed control. If you change the width of the ABC three-phase
windings h8 potential, it will lead to power-on and power-off change in the rate of
change, so that the motor speed change, so adjust the pulse cycle operation speed can
be controlled stepper motor.
⑶Rotation angle control. Because the input pulse to the stepping motor of a CP
state changes a phase winding, and a corresponding rotation angle, the rotation angle
92
as follows, each pulse control their turn 1.8 degrees.
stepping motor; through 8 key switches S1-S8 to control the rotation angle of the
stepping motor.
module DIP switch, key switch, stepper motor modules. Which digital
signal source, thumbwheel switch, key switch and the FPGA pin connector
platform located in the upper left, and its working status through a
jumper to choose. The control circuit shown in Fig 15-2 below. With the
93
Fig 15-2 Stepper motor Driver Schematic
Table 15-1 Stepper motor module Interface with the FPGA pin connection table
2、 then create a VHDL File and open VHDL Editor dialog box.
3、 The user can refer to the example provided in the program CD and write
VHDL program.
4、 After finish writing VHDL program, to store it. Approach with the
experimental one.
switch and the FPGA pin connections or reference table in Appendix Pin
94
assignment. Table 15-2 is an example of the program's Pin assignment table.
7、 with the corresponding burner download sof file is loaded into the FPGA via
loaded into the target component design, digital clock selection 1KHz,
95
press Key switch S1-S8, Stepper motor will rotate in accordance with the
corresponding step angle programming. Slide the DIP switch K1, Stepper
96
Experiment 16 PS2 Keyboard and Display Interface
Experiment
I、 Experiment Object
1、To learn simple communication protocol with FPGA design methods.
(clock signal terminal) to synchronize and exchange data via DATA (data port). If
you want to suppress any party to the other party's communication, just put CLOCK
pulled low.
PS2 standards and specifications of each data transmission contains the start bit
(start bit), scan code (scan code), odd parity (odd parity), and the termination bit
(stop bit) a total of 11 bit, and two-way serial data transmission mode, to achieve the
purpose of communication. And when the host (host) or not transferred from the
machine side (slave) or receiving data, the data transfer port, and both will be
exalted frequency potential. Figure 16-1 shows the contents of each packet of data
3. odd parity, the scan code and add up the number 1 odd parity is odd.
97
Fig 16-1 PS2 Serial transmission standards
PS2 control interface to use only two ports, one for the frequency of the port,
the other is the data port as shown in Fig 16-2, and this will be for the tri-state
both are the same, only the scan code (scan code) is different. So we PS2 keyboard
as an example.
Although different keyboard may use different processors, but they are
the same task, namely to monitor what the button is pressed, which keys
are released, and sends this information to the host. If necessary, the
processor handles all to shake, and its 16-byte buffer of data in the
communication and the processor decodes the information from the keyboard,
98
of matter. Communication between the host and the keyboard still using
IBM's agreement.
sends a "scan code" information to the host. Scan codes are two different
types: "Pass Code" and "break the code." When a key is pressed or long
press time, the keyboard sends a pass code; when a key is released, the
keyboard sends the broken code. Each keyboard is assigned a unique code
and break through the code, so to find a host through a unique scan code
can determine which key is pressed or released. Each key code composed
of a set-off of the "scan code set", and now all the keyboard scan codes
are used second. Since there is no one simple formula to calculate the
scan code, so you know a particular key pass code and break codes, can
through the key code value represents a key on the keyboard, it does not
mean that the characters printed on the keys, which means there is no
In addition, the second pass code is only one byte wide, but there
are a few "expand button" pass code is a set of two-or four-byte wide,
the first byte is always such a code 0xE0 . The pass code, each button
when released, the keyboard sends a broken code. Each key also has its
between the broken code and break codes. Most of the second set breaking
yards have two words long, their first byte is 0xF0, the second byte is
the corresponding key pass code. Expansion keys breaking yards are
usually three bytes, the first two bytes 0xE0 and 0xF0, the last byte
99
is the last byte of the key pass code. Table 16-1 lists the keyboard pass
U
H 33 F0,33 TAB 0D F0,0D 63 F0,63
ARROW
D
J 3B F0,3B L SHFT 12 F0,12 60 F0,60
ARROW
R
K 42 F0,42 L CTRL 11 F0,11 6A F0,6A
ARROW
100
Y 35 F0,35 F5 27 F0,27 KP 6 74 F0,74
PRNT
6 36 F0,36 57 F0,57 . 49 F0,49
SCRN
Experimental box used PS2 keyboard interface with the FPGA interface
circuit as shown in Fig 16-3. With the FPGA pin connections as shown in
Table 16-2.
101
KB_CLK Pin_B9 JP1_30 KeyBoard clock
Table 16-2 PS2 keyboard interface with the FPGA pin connection table
2、then create a VHDL File and open VHDL Editor dialog box.
3、The user can refer to the example provided in the program CD and write.
VHDL Example programs provide two VHDL source code. Every one of the
4、After finish writing VHDL program, to store it. Approach with the experimental
one.
5、To compile and generate VHDL module component files and error and modify
the program. All programs produced by the compiler module component files.
6、Create a graphic editing files, modules, components file into which would have
Fig 16-4.
102
Fig 16-4 Edited graphic design files
8、Compiled simulation is correct, according to the DIP switch, LED and FPGA pin
PS2 Synchronous
KYCOCLK PS2Module clock Pin_B9
Clock
103
G 7-Seg LED G Pin_R14
SA DEL0 Pin_N17
SB DEL1 Pin_P17
SC DEL2 Pin_R16
9、Download burner with the corresponding sof file is loaded into the FPGA via
keyboard interface, PS2 interface. When the design file is loaded into
the target cell, the Digital signal module clock is selected as 24MHz,
press the button on the PS2 keyboard, then in the middle of the 8-7-Seg
LED two experimental platform is the key element will be displayed scan
the keyboard scan codes to scan on 7-Seg LED does not change.
104
Experiment 17 VGA color signal generator design
I、 Experiment Object
1. Understanding Timing ordinary display correctly displayed.
ray tube) basic principle has been in use for decades, until today has not changed much.
The monitor is a complex device, its scalability, and reliability is also very alarming, in
this regard, the electronic control plays a big role, there will be no mechanical wear
and extend the life of electronic order only, or even thousands of hours to adapt work.
CRT's electron gun is a core electron beam emitted hit photosensitive material
(fluorescent) to stimulate phosphor can produce images. In fact, an electron gun and a
large volume, strong power diodes is no different, the principle also applies to
CRT is divided into several parts: Deflection Coil (yoke) for positioning the
electron gun emitters, which can generate a strong magnetic field, by changing the
intensity of the electron gun to move. The angle of deflection coils is limited, when the
electron beam is propagated to a flat surface, the target energy is slightly offset, only
part of the phosphor is struck, will produce an image edges are bent. To solve this
problem, the display tube made of a spherical plant, sufficiently to allow the phosphor
receiving energy, the disadvantage is the display will become bent during electron
beam shot by left, top to bottom is called refresh constantly repeat refresh to maintain
Color display screen is composed of RGB (red, green, blue) synthesized three
colored light, we can adjust the hue by three groups of other colors, in many image
105
processing software are provided in the color matching function, you can enter the
three primary color values to the deployment, the software can also be supplied
directly from the palette to select a color. In this part of the function of the
experiment only used the RGB tricolor consisting of 8 colors to constitute a color
signal.
VGA monitor display process mainly consists of five control signals, respectively,
R, G, B, HS and VS. Wherein R, G, B three primary colors are used to drive a display
monitor, i.e., red, green, and the basket, HS is the line synchronization signal, VS is the
vertical sync signal. In doing this experiment, since there is no display driver, so the
display in the default state, Resolution: 640 × 480, refresh rate: 60Hz. In this state,
when the VS and HS are low potentials, VGA display is ON, the forward scan is about
26us. After the end of the scan line, the line sync signal HS is set high potential, the
last about 6us, the low potential to high potential during the HS, the display blanking
signal is generated, which is the display retrace process. Upon completion of a scan,
the scan is finished after 480 horizontal and vertical sync signal VS is set high potential
to produce vertical sync, the sync signal can scan line back to the first line of the
display in the first column position. The display shows the timing diagram shown in
106
T1 is a synchronous blanking signal above figure, the pulse width is about 6us, T2
line display process is about 26us, T3 to the line sync signal, a width of two horizontal
or patterns on the display, requiring a CRT monitor can display horizontal stripes,
vertical stripes and checkerboard patterns. Experimental module system clock select
clock 12MHz, with a key module S1 to control the display mode, each press on the
screen to change the pattern of the first, followed by horizontal stripes, vertical stripes
and checkerboard patterns. The output of the experiment is output directly to the VGA
Experimental box used in digital clock module, Key switch and FPGA
interface circuits, and digital clock source, Key switch and the FPGA pin
repeat them here. VGA interface experimental system video input and output
trichromatic signal is output through the codec chip or directly from the
107
Table 17-1 is VGA connector connected directly to the FPGA table
Table 17-1 VGA connector is connected directly to the FPGA table after pin.
2、then create a VHDL File and open VHDL Editor dialog box.
3、The user can refer to the example provided in the program CD and write
VHDL program.
4、After finish writing VHDL program, to store it. Approach with the experimental
one.
5、To compile and simulate VHDL and then modify the program for errors.
module, Key switch module and the FPGA pin connections table or reference
assignment table. After the assignment is complete, and then compile a whole,
108
R VGA module R
Pin_AB13
signal
G VGA module G
Pin_L6
signal
HS VGA module
Pin_AB10
synchronous
VS VGA module
Pin_AA10
synchronous
7、Download burner with the corresponding sof file is loaded into the FPGA via
file is loaded into the target cell, the system will display the
experimental module for VGA video input and output interface linking
the three million jumpers select all of its module on FPGA (jump to
the VGA connector on the display screen will appear vertical color
signal. Press Key switch module of the S1 key will change the color
109
3、Programs written test other VGA graphics display.
110
Experiment 18 VHDL Design with Seven Voting
I. Experiment Object
1、 Familiar with VHDL program.
with more than half the votes, they think this behavior is feasible; otherwise rejected if
agreed number of votes greater than or equal 4:00, then that consent; Conversely, when
the rejection is greater than the number of votes equal to or 4:00, then that does not
agree. Experiments using seven DIP switches to said seven people, when '1
corresponding DIP switch input ', this means that people agree; otherwise if DIP switch
input is '0', it means against it. Results of the vote with an LED indicates the result if
the vote was agreed that the LED is lit; Otherwise, if the results of the vote for the
opposition, the LED is not lit. Meanwhile, the number of votes by the 7-Seg LED on
the display.
LED module and 7-Seg LED module to implement a simple seven voting function.
Refers to the switch module in the K1 dial ~ K7 said seven people, when DIP switch
input is '1 ', which means that the corresponding cast votes in favor, or when the DIP
switch input is '0', which means that people vote against the corresponding; LED
module LED1 indicates the result of the vote of seven, when LED1 is lit, which means
111
that this behavior by voting; otherwise when LED1 is off, this behavior is not by vote.
In this experiment 7-Seg LED, LED, DIP switch and the FPGA pin connector to
connect the circuit and in previous experiments have done a detailed description, not
2、 then create a VHDL File and open VHDL Editor dialog box.
3、 The user can refer to the example provided in the program CD and write
VHDL program.
4、 After finish writing VHDL program, to store it. Approach with the experimental
one.
5、 Compile and simulate VHDL program, and then modify the program for errors.
6、 Compiled simulation is correct, according to the DIP switch, LED, 7-Seg LED
with the FPGA pin connections or reference table in Appendix Pin assignment.
Table 18-1 is an example of the program's Pin assignment table. After the
effect.
Pin Name Module Signal FPGA IO Description
K1 DIP Switch K1 Pin_W6
112
LEDAG1 7-Seg LED module B Pin_H14 votes
LEDAG2 7-Seg LED module C Pin_H16
7、 With the corresponding burner download sof file is loaded into the FPGA via
is loaded into the target cell, toggle the experimental system of the middle
finger DIP switch module K0-K7 seven million DIP switch, if the DIP switch
is "1" (referring DIP switch switch to the upper end of said person by a
vote) is greater than or equal to the number of seasons LED module LED1
is lit, otherwise LED1 is not lit. By voting, while the number displayed
analyze the results and the analog waveform hardware and test results.
113
Experiment 19 Design Four Responder with VHDL
I. Experiment Object
1、Familiar four Responder works.
it appears, eliminating the original because the human eye is unable to correct the error
The principle is relatively simple Responder First Responder allows the flag to be
set a bit, the purpose is to allow or prohibit the answer by pressing the button; If
Responder enable bit is valid, then the first answer by pressing a button will clear it,
but No. Record button, press the corresponding button is the man, the purpose of doing
so is to ban someone and then press the button behind the case. Overall, the Responder
Responder allows the realization that the rear valid, the first person to press the button
to clear it to disable a button is pressed again while recording clear answer button
allows the bit serial number and displayed this is the realization of the principle
Responder.
allows the S5 to make answer button with S1 ~ S4 to represent the 1st Responder
Responder No. 1-4, but with LED module for LED1 ~ LED4 respectively in
Responder corresponding seat. Specific requirements are: S12 pressed once, allowing
one answer, then S1 ~ S4 in the first press of the button will allow the bit clear answer,
while the corresponding LED lights to indicate the corresponding key answer
successfully. 7-Seg LED shows the corresponding answer in the number of winners.
114
In this experiment 7-Seg LED, LED, Key switch and the FPGA pin connector to
connect the circuit and in previous experiments have done a detailed description, not
2、 Then create a VHDL File and open VHDL Editor dialog box.
3、 The user can refer to the example provided in the program CD and write
VHDL program.
4、 After finish writing VHDL program, to store it. Approach with the experimental
one.
5、 Compile and simulate VHDL program, and then modify the program for errors.
6、 Compiled simulation is correct, according to Key switch, LED, 7-Seg LED with
the FPGA pin connections or reference table in Appendix Pin assignment. Table
19-1 is an example of the program's Pin assignment table. After the assignment
115
lights
7、 With the corresponding burner download sof file is loaded into the FPGA via
is loaded into the target cell, press the button Key switch of S12,
indicates the start of answer. Then, while pressing the S1-S4, the first
key pressed is displayed Key 7-Seg LED, the corresponding LED lamp is lit.
analyze the results and the analog waveform hardware and test results.
116
Experiment 20 Positive and Negative Pulse Width
Modulation Signal Generator Design
I. Experiment Object
1、Learn to master the principles of positive and negative pulse width modulated
so-called positive and negative pulse is the direct digital control input the number of
positive and negative pulse width pulse signal number , of course , the number of
positive and negative pulse once finalized, will determine the periodic pulse wave
down . Second, the modulation signal, there are many modulation signal with
experiment, only the output waveform of a most simple digital modulation EDA design
Non-modulated wave is the original pulse waveform ; positive pulse in the pulse
modulated output is '1 ' the output of another period of the frequency with a square
wave , pulse wave and a '0' or a component of the original waveform ; positive and
negative pulse modulation is just pulse modulation contrast, the pulse wave output is
required in the '0 ' output of the other frequency square wave period, '1 ' is output
during the original waveform . To simplify the experiment , here 's modulation
waveform ( another frequency square wave ) on the use of the original clock signal.
117
Fig. 20-1 Modulation waveform
modulated signal digitally controlled generator. Requires the ability to output a digital
pulse width of positive and negative control, the positive pulse and a pulsed negative
pulse waveform of the pulse modulation. Experiment clock signal selects the clock
module of 1MHz signal, with the DIP switch module is K1 ~ K4 as a positive pulse
width of the input, with K7 ~ K10 as a negative pulse width of the input, with Key
switch module in S1 as a model selection keys, each press changes the pulse waveform
output once, followed by the original pulse, positive and negative pulse modulation
In this experiment, the middle finger DIP switch, Key switch, the observed
output terminal connected to the FPGA circuit and pin connections in previous
4、 then create a VHDL File and open VHDL Editor dialog box.
5、 The user can refer to the example provided in the program CD and write
VHDL program.
6、 After finish writing VHDL program, to store it. Approach with the experimental
118
one.
7、 Compile and simulate VHDL program, and then modify the program for errors.
8、 Compiled simulation is correct, according to the DIP switch, Key switch, the
output of the observation point and the FPGA pin connections or reference table
assignment table. After the assignment is complete, and then compile a whole, so
Output mode
MODE Key switch S1 Pin_B12
selection
9、 with the corresponding burner download sof file is loaded into the FPGA via
119
In reference to the example design, for example, when the design file
is loaded into the target cell, the Digital signal module clock selection
of 1MHz, DIP switch toggle octet, so K1-K4 in at least one of high potential,
K5-K8 at least one of high potential, the output module observation can
of high and low potential of the high potential number K1-K4 and K7-K10
shown.
analyze the results and the analog waveform hardware and test
results.
120
Comprehensive Design of Experiments
Experiment 21 Digital Frequency Meter Design
I. Experiment Object
1. Understand and other precision frequency measurement methods and
principles.
If the predetermined time interval T (also called the shutter time) was measured
expressed as
f=N/T
You can see from the above expression, if the time interval T take 1s, then f = N. Since
the start and end time for the gate signal is random, the quantization error will have a
pulse period. Further analysis of measurement accuracy: Set the test signal pulse
period Tx, frequency Fx, when the measurement time is T = 1s, the measurement
accuracy of δ = Tx / T = 1/Fx. It can be seen that the direct measurement method for
measuring the frequency and accuracy of the measured signal frequency, when the
high frequency signal to be measured, the measurement accuracy is high, whereas the
low measurement accuracy. Therefore, this method is only suitable for direct frequency
measurement higher measuring frequency signal, can not be met within the entire
121
measurements.
across the inside of the band, can achieve the same accuracy of measurement,
The portion of the zero pulse to control the coordination of the two
counters start pulse. Counters 1 and 2 were used to counter and measured
synchronous gate control counter counts N1, counter 2 counts N2, assuming
frequency standard frequency of F1, the measured frequency bit Fx, then
Fx/N2=F1/N1;…………………(1)
Fx=(F1/N1)* N2……………(2)
122
mainly determined F1, so in order to improve the measurement accuracy, the
measurement error can reach 10-6. In this circuit, the frequency standard
burst gate signal under test design methods varied by the students
independently.
In this study, the direct frequency measurement method for frequency measurement.
A fixed gate time is 1s, the gate signal is a square wave of 0.5Hz, the effective period
of the shutter (high potential), the input of the pulse counting time of the falling edge
of the strobe signal latches the current count value to zero and All frequency counters.
Since the gate time is 1s (0.5Hz square wave), so the frequency display is updated
every 1s, the content and the display when the gate is latched on the falling value.
ecause we set the gate time is 1s, so this can only be measured by the frequency
meter frequency greater than or equal to 1Hz case, and the higher the frequency, the
higher the accuracy. Practical applications, frequency meter variable gate time is
available, when the frequency is less than 1Hz, the gate time is necessary to properly
amplified. , A standard clock, as the unit of time: 0.1 seconds of the measured pulse
In the design frequency meter, when 8 7-Seg LED can display up to 99,999,999
Hz, therefore, when used in the design of 8 4-bit binary code (BCD code) to indicate,
also must have the same 8 four bit binary input frequency to be counted, when the
falling edge of the gate, the latter value is latched into the register. Its signal timing
123
relationships shown in Figure 21-2 follows:
clock selection 50M clock core board, the gate time is 1s (via the system clock
frequency to be), the gate for the duration of the high potential of the frequency of
the input will be count, when the gate goes low when recording current frequency
value, and zero frequency counter, frequency display is updated once every two
seconds too. Measured frequency through a DIP switch to choose whether to use the
system clock source module digital clock signal or a digital signal input through the
input from the external input and output module of the system frequency
measurements. When the DIP switch is a high potential, digital signal input from the
external measurement, otherwise the digital measuring system clock signal module
digital signal. Its realization block diagram is shown below in Figure 21-3:
124
Fig 21-3 Frequency measurement block diagram realization
In this experiment, the use of the module has Digital signal module,
DIP switch module, 50M system clock source module, 7-Seg LED display
module and so on. Which 7-Seg LED, Digital signal, DIP switch and the
have done a detailed description, not repeat them here. Module 50M system
clock source is located in the bottom of the core board EP3C40 50M through
please refer to the user manual. With the FPGA pin connections as shown
in Table 21-1.
Table 21-1 50M system clock and the FPGA pin connection table
2、 then create a VHDL File and open VHDL Editor dialog box.
3、 The user can refer to the example provided in the program CD and write
code. Every one of the original program to complete certain functions. The
125
File Name Completed Funtions
CLKOUT.VHD Generate the gate signal 1Hz and 1KHz display scanning signal
32-bit latch, the latch control signal at the role of the count value
SEG32B.VHD
latched
8、 After finish writing VHDL program, to store it. Approach with the
experimental one.
9、 To compile and generate VHDL module component files and error and
modify the program. Eventually all programs produced by the compiler and
VI.
10、 A new graphical editing files, module component file into which would have
11、 Programs compiled simulation and modify the program. And ultimately
12、 Compiled simulation is correct, according to the DC motor, the Hall element,
7-Seg LED with the FPGA pin connections or reference table in Appendix
table. After the assignment is complete, and then compile a whole, so Pin
126
Pin Name Module Signal FPGA IO Description
13、 With the corresponding burner download sof file is loaded into the FPGA via
is loaded into the target cell, toggle DIP switches K1, it is set to a
127
high potential, input and output from the input observation module input
a frequency greater than 1Hz clock signal, then this clock signal
Seven-segment value system. Digital signal change clock, see the value
analyze the results and the analog waveform hardware and test results.
128
Experiment 22 Multi-function Digital Clock Design
I. Experiment Object
1、 To understand the digital clock works.
2、 Familiar with the use of VHDL language driver 7-Seg LED code.
must first know the watch works, watch the entire work should be in the role of 1Hz
signal is carried out, so that each clock signal, second increase in one second, when the
seconds from 59 seconds to jump to 00 seconds, 1 minute minute increase , but when
the minutes from 59 minutes to jump to 00 min, hours increased 1 hour, but note that
and seconds are displayed from 0 to 59, so you can use a 3-bit binary code display ten
bit, with a four-element binary code (BCD code) display a bit, for the hour as it ranges
from 0 to 23, so you can use a 2-bit binary code display ten bit, using 4-bit binary code
(BCD code) display a bit.
Experiments is due 7-Seg LED scan display, so although the clock is required
1Hz clock signal, but do need to scan a relatively high frequency signal, so in order to
obtain accurate 1Hz signal, the input system clock must be of frequency.
For the whole point timekeeping function, users can be designed according to the
hardware structure of the system and their own specific requirements. The
experimental design was carried out when the whole point of the countdown timer 5
129
The experimental task is to design a multi-functional digital clock display format
for the required hours - minutes - seconds, the whole point timekeeping, timekeeping
time is 5 seconds, 5 seconds from the start before the whole point timekeeping tips,
LED starts flashing, cross the whole point, to stop flashing. System clock selection
Clock module of 10KHz, to get 1Hz clock signal, the system must be 10,000 times the
clock frequency. Buttons to adjust the time using the button module S1 and S2, S1
adjust the hours, every time you press, hours increase one hour, S2 adjust minutes,
every time you press, minutes, increases a minute. Also used as a system clock reset
Experimental box used in digital clock module, Key switch, LED, 7-Seg
LED with FPGA interface circuits, and digital clock source, Key switch,
LED, 7-Seg LED with the FPGA pin connections in previous experiments have
2、 Then create a VHDL File and open VHDL Editor dialog box.
3、 The user can refer to the example provided in the program CD and write
VHDL program.
4、 After finish writing VHDL program, to store it. Approach with the
experimental one.
5、 Compile and simulate VHDL program, modify the program for errors, until
lights and FPGA pin connection table or reference in Appendix Pin assignment.
Table 22-1 is an example of the program's Pin assignment table. After the
130
effect.
7、 With the corresponding burner download sof file is loaded into the FPGA
via JTAG. Observed experimental results are consistent with their programs.
131
is loaded into the target cell, the Digital signal module clock selection
is 1MHz, 7-Seg LED began to show time, beginning from 00-00-00. The whole
point of 5 seconds before the time, LED light module for LED1-LED5 starts
blinking. Once over the whole point, LED stops. Press Key switch of S1,
S2 hour and minute to start stepping adjustment time. Press Key switch
process, compile and analyze the results and the analog waveform
132
Experiment 23 Digital Stopwatch Design
I、 Experiment Object
1、To learn the basis of digital stopwatch..
Works and experimental code table is basically the same fifteen multifunctional
clock, the only difference is that because of a timing clock signal code table, due to its
resolution of 0.01 seconds, so the entire working clock stopwatch clock signal at
100Hz under complete. When the chronograph is less than a little from time to time,
equal to one hour, and the multi-function display is the same as the clock is hh-mm-ss
(hh is the hour: 0 to 99), due to the function and chronograph timepiece is different, so
hh code table indicates the range is not 0 to 23, but 0 to 99, and this is not the same
In the design of the code table when the clock selection is 100Hz. Variable
selection: Because xx (0.01 seconds) and hh range (hours) that are 0 to 99, so with two
4-bit binary code (BCD code) said; while ss (seconds) and mm (min) represents the
range from 0 to 59, so with a 3-bit binary code and a 4-bit binary code (BCD)
representation. Show time to pay attention to issues that hour judgment, if the hour is
133
selection 1KHz, due to the timing clock signal to 100Hz, so the need for the system
clock divided by 10 to get the reason for choosing 1KHz clock is needed because
7-Seg LED scan display, so choose 1KHz. In addition to easy to control, the need for a
reset button to start and stop the timer button chronograph buttons, key module were
selected experimental box of S1, S2 and S3, press S1, the system is reset, all the
registers of all zero; Press S2, start the stopwatch timing; press S3, stopwatch stop the
clock, and 7-Seg LED shows the current time of time, if you press S2 again, stopwatch
timing continues until press S1, the system can be reset to show all 00-00-00.
Experimental box used in digital clock module, Key switch, LED, 7-Seg
LED with FPGA interface circuits, and digital clock source, Key switch,
LED, 7-Seg LED with the FPGA pin connections in previous experiments have
2、then create a VHDL File and open VHDL Editor dialog box.
3、The user can refer to the example provided in the program CD and write
VHDL program.
4、After finish writing VHDL program, to store it. Approach with the experimental
one.
5、Compile and simulate VHDL program, and then modify the program for errors.
6、Compiled simulation is correct, according to the DIP switch, LED and FPGA pin
134
CLK Digital signal Pin_A14 Clock is 1KHz
Stopwatch starts
START Key switch S1 Pin_T2
counting
Stopwatch stops
OVER Key switch S2 Pin_B12
counting
7、Download burner with the corresponding sof file is loaded into the FPGA via
file is loaded into the target cell, the Digital signal module clock
from 00-00-00. Until you press the Stop button (Key switch S2). 7-Seg
LED to stop the seconds. Press the Start button (Key switch S1), 7-Seg
135
LED continue to count seconds. Press the reset button (Key switch S3)
analyze the results and the analog waveform hardware and test results.
136
Experiment 24 Taxi meter design
I、 Experiment Object
1、Learn taxi meter works.
$ xx (xx bit can walk x km), and then is xx bit / km. So to complete a taxi meter, there
should be two counts, one for total kilometers, another one for expenses. Usually have
sensors on the wheels of a taxi, used to record the number of turns the wheels turning,
and the circumference of the wheels is fixed, so we know the number of turns naturally
know the mileage. In this experiment, we must simulate the operation of the taxi meter,
a DC motor simulation taxi wheel through the sensor, the motor can be one pulse per
revolution of the output waveform. Results are displayed with 8 7-Seg LED, the first
VHDL design program, the first action in the reset signal will be zero for all
registers used, and then start setting the starting price records state, in this state, have
been displayed at the starting price in the specified mileage Pricing starts until the
specified mileage distance than the starting price, the system is transferred to the charge
per kilometer state, then each additional kilometer meter corresponding increase in costs.
Also talk about the process of writing some tips. In order to facilitate the display,
data used in the preparation process of the BCD code to display, so there is the problem
of data format conversion. For example, said a three-digit, four bit respectively, then the
binary code to indicate when the single-digit accumulate more than 9:00, which was zero,
137
III、 Experiment Subject
In this study, to complete the task is to design a simple taxi meter, the requirement is
starting at $ 3, quasi-line one kilometer, after one bit / km. Display portion 7-Seg LED
clock module's scan clock selection 1KHz, jumper motor module selection GND
terminal, so by turning the potentiometer motor module can achieve the purpose of
controlling the motor speed. In addition to using the S1 key module of the whole
system as a reset button, reset each time, billing billing from scratch. DC motor is used
to simulate a taxi wheels, each rotation considered walking one meter, so every lap
rotation 1000 that the car forward one kilometer. System design is needed for detecting
the rotation of the motor per revolution, the counter is incremented by 1 meter. 7-Seg
LED display requirements for the first four displays mileage, after three display costs.
module, 7-Seg LED with FPGA interface circuits, and digital clock source,
Key switch, LED, 7-Seg LED with the FPGA pin connections in the previous
2、then create a VHDL File and open VHDL Editor dialog box.
3、The user can refer to the example provided in the program CD and write
VHDL program.
4、After finish writing VHDL program, to store it. Approach with the experimental
one.
5、Compile and simulate VHDL program, and then modify the program for errors.
6、Compiled simulation is correct, according to the DIP switch, LED and FPGA pin
138
complete, and then compile a whole, so Pin assignment to take effect.
7、Download burner with the corresponding sof file is loaded into the FPGA via
module is 1KHz, the module selected for DC motor "ON", the rotation
7-Seg LED to display the value of the design are the same.
139
1、To draw analog waveform and illustrate.
process, compile and analyze the results and the analog waveform
140
Experiment 25 Design of Digital Locks with VHDL
I、Experiment Object
1、Understanding digital lock works.
II、Experiment Theorem
Also known as a digital lock password lock, it only needs to remember your master
password to unlock, open the door only need to enter the password, you can open the
door, so the core of the problem is that the password lock alignment problem.
If there are six million locks, then after the system reset button 6 times a user to
enter a password string intact, finished sixth after entering the system for comparison, if
you find a password match, then open the door, otherwise require the use of who continue
to enter, if three consecutive strings are wrong password is entered, the system alarm
sounded until the correct password is entered, the alarm sound stops.
need to complete 4 × 4 keyboard scan , after a key is needed to determine access to its
Key, and encode , thus identifying key and press the corresponding Key for display.
connected to four rows , four , so to identify the key only needs to know which rows
and columns which can, in order to complete the identification process , the first output
4 first as a low potential , the other as a high potential , and then read the column value ;
then output 4 second as low potential , read the column values , and so on , continually
loop. System when reading row value will automatically determine if the incoming line
read all of the high potential value , then there is no button is pressed , or if the value of
reading lines incomplete discovery came as high potential , then there must be a
keyboard entire column at least one button is pressed, the value of this time to read the
141
line and current column values , you can determine the current key position. Get to the
row and column values in the future , a combination of an 8- bit data , depending on
the implementation of different coding in the match for each button , find the Key
III、Experiment Subject
The experiment was a need to complete the task locks, taking into account the
system has a keyboard scan, 7-Seg LED display and alarm clock module of the system
clock select 10KHz clock. Keyboard scanning and display are used 1KHz (10 points
on the system clock frequency), when you enter a password, 7-Seg LED from right to
left button corresponding values for each key (0 to 9) once to display the left once,
after the end of the 6th password verification system began after the end of the
verification, 7-Seg LED all off. That is, the time display is the key part of maintaining
six times and check the time. Enter the password incorrectly three times in a row to
start the alarm. Experiment with the LED module is required LED1 indicates the
keyboard state, if a key is pressed, LED1 lights, until you release the button; using
LED2 indicates the status of the door, which is password verification result, if correct
password verification, LED2 lights since, otherwise, if the password validation error
LED2 blinks four times and then turns off, indicating that the password is wrong.
RESET button to reset the system with the core of the board, when reset, 7-Seg LED
are off.
Experimental box used in digital clock module, Key switch, LED, 7-Seg
LED, keyboard array and FPGA interface circuits, and digital clock source,
Key switch, speaker interface, LED, 7-Seg LED, keyboard array and FPGA the
not repeat them here. RESET button to reset the core board, refer to the
142
IV、Experiment Step
1、Open QUARTUSII software and reate a new project.
2、then create a VHDL File and open VHDL Editor dialog box.
3、The user can refer to the example provided in the program CD and write
VHDL program.
4 、 After finish writing VHDL program, to store it. Approach with the
experimental one.
5、To compile and simulate VHDL, modify the program for errors, until
7、Download burner with the corresponding sof file is loaded into the FPGA via
is loaded into the target cell, the Digital signal module clock selection
is 10KHz, press the keyboard matrix digital key, 7-Seg LED will be
displayed in turn pressed Key. Each time you press a key, LED1 will flash
once. If the input data and program settings data are the same, the LED
D12 is lit. If you make a mistake, then the D12 LED lights flashing.
VI、Experiment Conclusion
1、 To draw analog waveform and illustrate.
143
process, compile and analyze the results and the analog waveform
144
Schedule I:CPU Board And FPGA(EP4CE40) Pin Mapping
145
Signal Name FPGA IO Signal Name FPGA IO
CPU Board SRAM(IDT74V416)
A0 W20 D11 T18
A1 AA21 D12 R19
A2 Y21 D13 R20
A3 Y22 D14 R18
A4 W21 D15 P20
A5 W22 D16 G18
A6 V21 D17 H20
A7 P22 D18 H18
A8 N21 D19 J18
A9 N22 D20 K18
A10 M21 D21 N18
A11 M22 D22 M20
A12 L21 D23 M19
A13 L22 D24 F19
A14 K19 D25 F20
A15 K21 D26 F17
A16 V22 D27 F16
A17 U21 D28 D20
D0 AB17 D29 E16
D1 AA17 D30 D19
D2 AB18 D31 D17
D3 AA18 BE0 N20
D4 AB19 BE1 N19
D5 AA19 BE2 C17
D6 AB20 BE3 C19
D7 AA20 OE# H10
D8 U17 WE# H11
D9 U19 CS# W17
D10 U20 ------ ------
146
Signal Name FPGA IO Signal Name FPGA IO
CPU Board User Button
BT1 T21 BT3 G21
BT2 T22 BT4 G22
CPU Board 50M Clock
CLK50M G1 ------ ------
CPU Board Reset Button
RESET E4 ------ ------
CPU Board SDRAM
DQ0 C21 A0 B19
DQ1 B22 A1 A19
DQ2 B21 A2 B18
DQ3 C22 A3 A18
DQ4 D21 A4 D15
DQ5 D22 A5 C15
DQ6 E21 A6 E15
DQ7 E22 A7 D13
DQ8 B15 A8 C13
DQ9 A15 A9 E14
DQ10 B14 A10 A20
DQ11 A14 A11 B17
DQ12 B13 A12 A17
DQ13 A13 SD-M0 F21
DQ14 B10 SD-M1 A16
DQ15 A10 SD-BA0 J22
SD-CLK E6 SD-BA1 B20
SD-WE F22 RAS H22
SD-CS J21 CAS H21
SD-CKE B16 ------ ------
147
Signal Name FPGA IO Signal Name FPGA IO
CPU Board Expension JP1
1 5V 31 M6
2 GND 32 M7
3 J1 33 L7
4 J2 34 K7
5 H1 35 J7
6 H2 36 G7
7 G3 37 H7
8 F1 38 G8
9 F2 39 G9
10 E1 40 F8
11 D2 41 F9
12 C1 42 F10
13 C2 43 E11
14 B1 44 F11
15 C3 45 G13
16 B2 46 F13
17 A3 47 F14
18 B3 48 G14
19 A4 49 F15
20 B4 50 G15
21 A5 51 G16
22 B5 52 J6
23 A6 53 J3
24 B6 54 J5
25 A7 55 J4
26 B7 56 H5
27 A8 57 G5
28 B8 58 G4
29 A9 59 H6
148
30 B9 60 F7
Signal Name FPGA IO Signal Name FPGA IO
CPU Board Expension JP1
61 E3 71 E9
62 K8 72 E10
63 C4 73 D10
64 E5 74 C10
65 E7 75 E12
66 C6 76 A11(CLK10)
67 D6 77 B11(CLK11)
68 C7 78 A12(CLK8)
69 D7 79 B12(CLK9)
70 C8 80 E13
CPU Board Expension JP2
1 5V 21 H14
2 GND 22 H15
3 U10 23 G11
4 U11 24 /
5 V12 25 T15
6 V13 26 T17
7 U12 27 R17
8 U13 28 T16
9 U14 29 R16
10 U15 30 P17
11 T10 31 N17
12 T11 32 /
13 T23 33 G10
14 T14 34 H8
15 T13 35 J8
16 R14 36 M16
17 R15 37 K17
18 P16 38 J17
19 N16 39 H17
149
20 H16 40 G17
Signal Name FPGA IO Signal Name FPGA IO
CPU Board Expension JP3
1 5V 31 T8
2 GND 32 T9
3 M1 33 U8
4 M2 34 U9
5 N1 35 V8
6 N2 36 V9
7 P1 37 AA9
8 P2 38 AB10
9 R1 39 AA10
10 R2 40 AB11(CLK14)
11 T1(CLK3) 41 AA11(CLK15)
12 T2(CLK2) 42 AB12(CLK12)
13 U1 43 AA12(CLK130
14 U2 44 AB13
15 V1 45 L6
16 V2 46 M5
17 W1 47 N5
18 W2 48 P3
19 Y1 49 P4
20 Y2 50 P5
21 AA1 51 T3
22 Y3 52 T4
23 AB3 53 T5
24 AA3 54 V3
25 AB4 55 V5
26 N6 56 V4
27 P6 57 R5
28 R7 58 U7
29 R6 59 V6
150
30 T7 60 Y4
Signal Name FPGA IO Signal Name FPGA IO
CPU Board Expension JP3
61 V7 71 V11
62 W6 72 Y13
63 Y6 73 W13
64 Y7 74 W14
65 W7 75 W15
66 Y8 76 V14
67 W8 77 V15
68 V10 78 V16
69 Y10 79 U16
70 W10 80 Y17
------
151
Schedule II:System Board And CPU Board IO Mapping
D5 Pin_P2 A0 Pin_AA1
D6 Pin_R1 A1 Pin_Y3
D7 Pin_R2 A2 Pin_AB3
D8 Pin_U1 CS Pin_N6
D9 Pin_U2 RD Pin_AA3
CS DIN Pin_R7
152
Signal Name FPGA IO Signal Name FPGA IO
AEEDA/SOPC SYSTEM
8x7-Seg LED
BOARD
A Pin_H15 G Pin_R14
B Pin_H14 DP Pin_T13
F Pin_R15
R6 Pin_T14 C0 Pin_V8
R7 Pin_T12 C1 Pin_U9
R8 Pin_T11 C2 Pin_U8
R9 Pin_T10 C3 Pin_T9
K1 Pin_W6 K7 Pin_V7
K2 Pin_Y4 K8 Pin_V6
K3 Pin_U7 K9 Pin_R5
153
Signal Name FPGA IO Signal Name FPGA IO
EDA/SOPC SYSTEM BOARD 12 x Button
S1 Pin_B12 S7 Pin_A12
S2 Pin_B11 S8 Pin_A11
S3 Pin_V4 S9 Pin_V5
D2 Pin_B2 RD Pin_A7
D3 Pin_A3 CS Pin_B5
D4 Pin_B3 INT Pin_A6
D5 Pin_A4 RESET Pin_D10
D6 Pin_B4 USBH_CS Pin_C1
154
D7 Pin_A5 USBH_INT Pin_B7
AUDIO_BCLK Pin_J8
CS Pin_AB10 DO Pin_AA10
DI Pin_AB13 CD Pin_M5
DOUT Pin_C6
DIN Pin_C7
R Pin_AB13 HS Pin_AB10
G Pin_L6 VS Pin_AA10
B Pin_M5
155
RTC_CLK Pin_D2
D0 Pin_G9 D6 Pin_G13
D1 Pin_F8 D7 Pin_F13
D2 Pin_F9 D8 Pin_F14
D3 Pin_F10 D9 Pin_J6
D4 Pin_E11 CH Pin_G16
D0 Pin_K8 D7 Pin_J5
D1 Pin_H6 D8 Pin_G15
D2 Pin_F7 D9 Pin_G14
D3 Pin_G5 CH Pin_E5
D5 Pin_H5 WR Pin_E3
D6 Pin_J3
DS18B20 Pin_D7
IICSDA Pin_E10
IICSCL Pin_E9
MT_PWM Pin_F1
156
MT_SPEED Pin_G3
13 -12V 33 Pin_E10
14 -12V 34 Pin_E9
15 Pin_J5 35 Pin_C10
16 Pin_J3 36 Pin_D10
17 Pin_H5 37 Pin_E13
18 Pin_J4 38 Pin_E12
157
19 Pin_G4 39 Pin_H17
20 Pin_G5 40 Pin_G17
1 Pin_F15 21 /
2 Pin_G14 22 /
3 Pin_G16 23 Pin_B9
4 Pin_G15 24 Pin_A9
5 Pin_J6 25 Pin_B8
6 Pin_F14 26 Pin_A8
7 Pin_F13 27 -12V
8 Pin_G13 28 -12V
9 Pin_F11 29 /
10 Pin_E11 30 /
11 Pin_F10 31 +12V
12 Pin_F9 32 +12V
13 Pin_F8 33 /
14 Pin_G9 34 /
15 Pin_G8 35 VCC
16 Pin_H7 36 VCC
17 Pin_G7 37 /
18 Pin_J7 38 /
19 Pin_K7 39 GND
20 Pin_L7 40 GND
158
159