EDA Development Manual English
EDA Development Manual English
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
4
1 0 0 0 0 0 1 0 0 0 0
1 0 1 0 0 1 0 0 0 0 0
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
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
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.
8
Fig 1-4 New Project Wizard
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
Fig 1-6 Device Setting
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
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.
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
12
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
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
13
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
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,
14
Fig 1-13 Storage Design File
then there QUARTUSII compiler window, as shown in Fig, the figure marked the
15
Fig 1-14 QUARTUSII compiler window
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
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
16
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
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
17
Fig 1-19 Pin assignment
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
(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
18
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
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
19
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
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
20
D0 LED1 Pin_AE8
D1 LED2 Pin_J22
D2 LED3 Pin_M24
D3 LED4 Pin_L24 8 Output Of
D4 LED5 Pin_L23 Decoder
D5 LED6 Pin_H23
D6 LED7 Pin_H24
D7 LED8 Pin_F24
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
21
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.
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
22
Fig 1-28 Node Finder
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
23
Fig 1-30 Edit Input Waveform
5)Specify the simulator settings, there are timing simulation and functional
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
24
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
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
25
Fig 1-33 Program Window
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
26
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,
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.
27
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
28
same as " It determines to come. Now citing a simple example proves.
If should convert yard to Grey binary scale yard 10110110, can finish by
following method, method such as Fig 2-1.
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
29
1)Select File>New in QUARTUSII software to order, presents New
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
30
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
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 Gegere coding
D5 LED5 Pin_L23 encoder output
D6 LED6 Pin_H23
D7 LED7 Pin_H24
D8 LED8 Pin_F24
31
D9 LED9 Pin_E24
D10 LED10 Pin_F22
D11 LED11 Pin_E22
D12 LED12 Pin_F21
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
32
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.
33
Fig 3-1 Counter Operation Timing
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.
34
Fig 3-3 Key switch module circuit schematic
Table 3-2 Key switch and the FPGA pin connection table
35
1、 Open QUARTUSII software, create a new project.
open VHDL Editor dialog box. According Experiment Theorem and their
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_A14 Clock is 1Hz
EN DIP Switch K1 Pin_AH12 Enable signal
RET Key switch S1 Pin_AF5 Reset Signal
CQ0 LED1 Pin_AE8
CQ1 LED2 Pin_J22
CQ2 LED3 Pin_M24
CQ3 LED4 Pin_L24
CQ4 LED5 Pin_L23
Count output
CQ5 LED6 Pin_H23
CQ6 LED7 Pin_H24
CQ7 LED8 Pin_F24
CQ8 LED9 Pin_E24
CQ9 LED10 Pin_F22
36
CQ10 LED11 Pin_E22
COUT LED12 Pin_F21 Carry bit signal
of COUT
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
37
Experiment 4 8 bit 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
38
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.
39
SEL[1] Pin_D22 JP2_31
SEL[2] Pin_G9 JP2_33
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.
40
LEDAG4 7-Seg LED E Pin_G15
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.
41
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.
42
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.
43
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.
44
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
45
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
46
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
47
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.
Pin Name Module Signal FPGA IO Description
CLK Digital signal Pin_A14 Clock is 1KHz
DATA0 DIP Switch K1 Pin_AH12 Show clock
48
DATA 1 DIP Switch K2 Pin_AF14 control Control
DATA 2 DIP Switch K3 Pin_AA8
DATA 3 DIP Switch K4 Pin_AB8
DATA 4 DIP Switch K5 Pin_AE4
DATA 5 DIP Switch K6 Pin_AC5
DATA 6 DIP Switch K7 Pin_AF12
DATA 7 DIP Switch K8 Pin_AG12
DATA 8 DIP Switch K9 Pin_AA10
DATA 9 DIP Switch K10 Pin_U8
DATA 10 DIP Switch K11 Pin_AE3
DATA 11 DIP Switch K12 Pin_AD4
RET Key switch S1 Pin_AF5 Reset Signal
COUT LED1 Pin_AE8 Flag is ignored
LEDAG0 7-Seg LED A 段 Pin_G16
LEDAG1 7-Seg LED B 段 Pin_G17
LEDAG2 7-Seg LED C 段 Pin_F18
LEDAG3 7-Seg LED D 段 Pin_G18
LEDAG4 7-Seg LED E 段 Pin_G15
Information
LEDAG5 7-Seg LED F 段 Pin_G14
Display
LEDAG6 7-Seg LED G 段 Pin_G12
LEDAG7 7-Seg LED DP 段 Pin_M21
DEL0 位選 DEL0 Pin_C22
DEL1 位選 DEL1 Pin_D22
DEL2 位選 DEL2 Pin_G9
11、 With the corresponding burner download sof file is loaded into the FPGA via
V. Experiment Result
49
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
50
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.
51
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
52
COUNT5 LED D6 Pin_H23
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.
53
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
54
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_A14 Clock is 1KHz
A0 DIP Switch K4 Pin_AB8
A1 DIP Switch K3 Pin_AA8 Multiplicand
A2 DIP Switch K2 Pin_AF14 data
A3 DIP Switch K1 Pin_AH12
B0 DIP Switch K10 Pin_U8 Multiplier Data
55
B1 DIP Switch K9 Pin_AA10
B2 DIP Switch K8 Pin_AG12
B3 DIP Switch K7 Pin_AF12
COUT0 LED12 Pin_F21
COUT1 LED11 Pin_E22
COUT2 LED10 Pin_F22
COUT3 LED9 Pin_E24
COUT4 LED8 Pin_F24
Two
COUT5 LED7 Pin_H24
multiplication
COUT6 LED6 Pin_H23
result output
COUT7 LED5 Pin_L23
COUT8 LED4 Pin_L24
COUT9 LED3 Pin_M24
COUT10 LED2 Pin_J22
COUT11 LED1 Pin_AE8
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.
56
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.
57
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:
58
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
59
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
60
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.
61
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 0≤T < M
Q=⎨
⎩0 M ≤T ≤ N
required output and duty cycle pulse wave can be changed. Specific experiment, the
62
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
63
ND Key switch S7 Frequency control /
Pin_AH14
reduce
MU Key switch S2 Duty cycle control /
Pin_AH6
increase
MD Key switch S8 Duty cycle control /
Pin_AG7
reduce
RST Key switch S12 Pin_AH11 Reset Control
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.
64
results of the analog waveform hardware and test results recorded.
65
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 n +1 R S Q n +1
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
66
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
67
programming errors to be modified.
effect.
Pin Name Module Signal FPGA IO Description
NR DIP Switch K1 Pin_AH12
Q LED12 Pin_F21
NQ LED1 Pin_AE8
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.
68
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
69
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)
70
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
71
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
72
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
73
G 7-Seg LED module G Pin_G12
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.
74
results of the analog waveform hardware and test results recorded.
75
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:
76
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
77
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
78
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.
79
DOT_R[0] Pin_C17 JP2_20
DOT_R[1] Pin_D15 JP2_19
DOT_R[2] Pin_D14 JP2_18
DOT_R[3] Pin_D13 JP2_17
DOT_R[4] Pin_D12 JP2_16
DOT_R[5] Pin_D10 JP2_14
DOT_R[6] Pin_C10 JP2_13
Dot array Row
DOT_R[7] Pin_C9 JP2_12
DOT_R[8] Pin_D21 JP2_29
DOT_R[9] Pin_C21 JP2_28 Data
program edit window, the user can refer to the example provided in the program CD.
4、
80
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
81
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
82
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.
83
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
84
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
85
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
86
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
87
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
88
the value of 7-Seg LED will be a corresponding increase or decrease.
to bits.
89
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
90
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
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
order. Usually took the ring pulse distributor generates three-phase six-step pulse.
⑵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
⑶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
The experimental box used for the 4-phase stepper motor stepper motor, the
minimum rotation angle of 1.8 degrees, the forward rotation of the control sequence is
91
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
92
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
93
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,
94
press Key switch S1-S8, Stepper motor will rotate in accordance with the
corresponding step angle programming. Slide the DIP switch K1, Stepper
95
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.
96
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,
97
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
98
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
99
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.
100
KB_CLK Pin_P25 JP2_118 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.
101
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_P25
Clock
102
G 7-Seg LED G Pin_G12
SA DEL0 Pin_C22
SB DEL1 Pin_D22
SC DEL2 Pin_G9
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.
103
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
104
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
105
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
106
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,
107
R VGA module R
Pin_E18
signal
G VGA module G
Pin_E17
signal
HS VGA module
Pin_E14
synchronous
VS VGA module
Pin_E15
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
108
3、Programs written test other VGA graphics display.
109
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
110
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_AH12
K2 DIP Switch K2 Pin_AF14
K3 DIP Switch K3 Pin_AA8
K4 DIP Switch K4 Pin_AB8 Seven voting
K5 DIP Switch K5 Pin_AE4
K6 DIP Switch K6 Pin_AC5
K7 DIP Switch K7 Pin_AF12
m_Result LED module LED1 Pin_AE8 Voting Result
LEDAG0 7-Seg LED module A Pin_G16 Voting by
111
LEDAG1 7-Seg LED module B Pin_G17 votes
LEDAG2 7-Seg LED module C Pin_F18
LEDAG3 7-Seg LED module D Pin_G18
LEDAG4 7-Seg LED module E Pin_G15
LEDAG5 7-Seg LED module F Pin_G14
LEDAG6 7-Seg LED module G Pin_G12
LEDAG7 7-Seg LED module DP Pin_M21
Table 18-1 Pin assignment
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.
112
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.
113
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
lights
DOUT1 LED module LED2 Pin_J22
2st Responder
lights
DOUT2 LED module LED3 Pin_M24
3st Responder
114
lights
DOUT3 LED module LED4 Pin_L24
4st Responder
lights
LEDAG0 7-Seg LED module A Pin_G16
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.
115
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.
116
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
117
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_AF5
selection
9、 with the corresponding burner download sof file is loaded into the FPGA via
118
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.
119
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
120
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)
121
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
122
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:
123
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
124
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
125
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
126
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.
127
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.
the whole point of time, in hours and minutes adjustable and other basic functions. We
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
n the experiment, in order to facilitate the display, because the range of minutes
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
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
128
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
129
effect.
7、 With the corresponding burner download sof file is loaded into the FPGA
via JTAG. Observed experimental results are consistent with their programs.
130
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
131
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
132
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
133
CLK Digital signal Pin_A14 Clock is 1KHz
Stopwatch starts
START Key switch S1 Pin_AF5
counting
Stopwatch stops
OVER Key switch S2 Pin_AH6
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
134
LED continue to count seconds. Press the reset button (Key switch S3)
analyze the results and the analog waveform hardware and test results.
135
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,
136
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
137
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.
138
1、To draw analog waveform and illustrate.
process, compile and analyze the results and the analog waveform
139
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
140
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
141
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.
142
process, compile and analyze the results and the analog waveform
143
Schedule I:CPU Board And FPGA Pin
144
Signal Name FPGA IO Signal Name FPGA IO
CPU Board SRAM(IDT74V416)
A14 R28 D18 N26
A15 T25 D19 P27
A16 AB27 D20 P28
A17 V26 D21 T22
D0 AC26 D22 T21
D1 AB25 D23 R24
D2 AB26 D24 L28
D3 AA25 D25 L27
D4 W25 D26 K28
D5 Y26 D27 K27
D6 V25 D28 H26
D7 W26 D29 G28
D8 AA22 D30 G27
D9 AA24 D31 F28
D10 Y24 BE0 R25
D11 Y23 BE1 AB23
D12 V24 BE2 E28
D13 V23 BE3 F27
D14 U24 OE# R26
D15 U23 WE# AB24
D16 M27 CS# AC24
D17 M28 ------ ------
CPU Board Serial
PC-TXD D3 PC-RXD B15
CPU Board User Button
BT1 Y27 BT3 J28
BT2 Y28 BT4 J27
145
Signal Name FPGA IO Signal Name FPGA IO
CPU Board 7-Seg LED
A AF4 E AF7
B AE5 F AD5
C AE6 G AF6
D AF8 DP AE7
146
Signal Name FPGA IO Signal Name FPGA IO
CPU Board USB2.0
USB-FLAGA B21 USB-CS B18
USB-FLAGB A21 USB-OE C27
USB-FLAGC C20 USB-WE B26
USB-ADR0 B19 USB-IFCLK G26
USB-ADR1 A19 ------ ------
CPU Board DDRII SDRAM
DRAM-DQ[0] AE25 DRAM-ADDR[0] AC21
DRAM-DQ[1] AE21 DRAM-ADDR[1] AB16
DRAM-DQ[2] AG26 DRAM-ADDR[2] AC15
DRAM-DQ[3] AD18 DRAM-ADDR[3] AF16
DRAM-DQ[4] AF20 DRAM-ADDR[4] AD21
DRAM-DQ[5] AH25 DRAM-ADDR[5] AE15
DRAM-DQ[6] AF22 DRAM-ADDR[6] AD15
DRAM-DQ[7] AE24 DRAM-ADDR[7] AE16
DRAM-DQ[8] AH22 DRAM-ADDR[8] AC17
DRAM-DQ[9] AG21 DRAM-ADDR[9] AF21
DRAM-DQ[10] AF24 DRAM-ADDR[10] AE17
DRAM-DQ[11] AD17 DRAM-ADDR[11] AE20
DRAM-DQ[12] AE19 DRAM-ADDR[12] AF15
DRAM-DQ[13] AH23 DRAM_BA[0] AH17
DRAM-DQ[14] AH21 DRAM_BA[1] AF17
DRAM-DQ[15] AG22 DRAM_DM[0] AF25
DRAM_nCLK AE23 DRAM_DM[1] AH19
DRAM_nCAS AH26 DRAM_DQS[0] AF26
DRAM_nRAS AE22 DRAM_DQS[1] AE18
DRAM_WE AH18 DRAM_CKE AG18
DRAM_nCS AG23 DRAM_CLK AF23
147
Signal Name FPGA IO Signal Name FPGA IO
CPU Board SD Card
SD-CS D4 SD-WP D6
SD-CLK C5 SD-DI D5
SD-CD C7 SD-DO C6
CPU Board Expension(EXT-PORT)
1-2 5V(VCC) 23 AG6
3-4 GND 24 AF5
5-6 3.3V 25 AG7
7 AA3 26 AH6
8 W1 27 AG8
9 AB1 28 AH7
10 AB2 29 AF9
11 AC1 30 AH8
12 AC2 31 AH10
13 AD1 32 AG10
14 AD2 33 AH11
15 AE1 34 AG11
16 AE2 35 AH12
17 AF3 36 AF12
18 AF2 37 AF14
19 AH3 38 AG12
20 AG3 39 AG14(CLK15)
21 AH4 40 AH14(CLK14)
22 AG4 ------ ------
148
Schedule II:System Board And FPGA
Signal
FPGA IO Signal Name FPGA IO
Name
D0 B11 D11 F3
D1 A10 D12 F5
D2 B10 D13 E3
D3 B8 D14 B12
D4 A8 D15 A12
D5 C8 A0 H4
D6 A7 A1 G5
D7 A11 A2 J3
D8 C12 CS K4
D9 G3 RD J4
D10 G4 WR K3
CS G6 PENIRQ L3
149
LED6 H23 LED12 F21
A G16 G G12
B G17 DP M21
E G15 SEL2 G9
F G14
R6 C10 C0 L5
R7 C9 C1 H6
R8 D21 C2 H7
R9 C21 C3 H5
K1 AH12 K7 AF12
K2 AF14 K8 AG12
K3 AA8 K9 AA10
K4 AB8 K10 U8
150
K6 AC5 K12 AD4
Signal Name FPGA IO Signal Name FPGA IO
EDA/SOPC SYSTEM 12Bit Buttons
S1 AF5 S7 AH14
S2 AH6 S8 AG7
S3 AH7 S9 AG8
S4 AH8 S10 AF9
S5 AG10 S11 AH10
S6 AG11 S12 AH11
EDA/SOPC SYSTEM 4*4 KeyBoard
C0 AD11 R0 AE13
C1 AD12 R1 AE12
C2 AF13 R2 AF11
C3 AE14 R3 AE11
EDA/SOPC SYSTEM COM Port
RXD AG14 TXD AA3
EDA/SOPC SYSTEM PS2 Keyboard
CLOCK P25 DATA P26
EDA/SOPC SYSTEMM PS2 Mouse
CLOCK M25 DATA N25
EDA/SOPC SYSTEM USB&USB HOST
D0 L25 A0 M26
D1 L26 WR D25
D2 K25 RD E26
D3 K26 CS E25
D4 J26 INT B14
D5 J25 RESET C15
D6 F25 USBH_CS D26
151
D7 F26 USBH_INT C25
Signal Name FPGA IO Signal Name FPGA IO
EDA/SOPC SYSTEM Ethernet
NET_INT C26 NET_SCK C23
NET-SO D24 NET_CS D16
NET_SI D23 NET_RST C15
EDA/SOPC SYSTEM Audio CODEC
AUDIO_BCLK C11
EDA/SOPC SYSTEM SD Card
CS D4 DO C6
CLK C5 WP D6
DI D5 CD C7
EDA/SOPC SYSTEM Video Encoder(ADV7171)
YIN0 E18 RESET AD3
YIN1 E17 IICSDA E8
YIN2 W1 IICSCL F8
YIN3 AB1 VD-PCLK F12
YIN4 AB2 VD-HS1 E14
YIN5 AC1 VD-VS1 E15
YIN6 AC2 VD-BLANK F17
YIN7 AD1
EDA/SOPC SYSTEM Video Decoder(TVP5150)
YOUT0 AF2 YOUT4 AG4
YOUT1 AH3 YOUT5 AG6
YOUT2 AG3 YOUT6 Y10
152
YOUT3 AH4 YOUT7 AB7
Signal Name FPGA IO Signal Name FPGA IO
EDA/SOPC SYSTEM Video Decoder(TVP5150)
IICSDA E8 VD_VBLK AD2
IICSCL F8 VD-FID AF3
VD-VS AE2 VD-PCLK AC3
VD-HS AE1 VD_RESET AD3
EDA/SOPC SYSTEM VGA
R E18 HS E14
G E17 VS E15
B W1
EDA/SOPC SYSTEM IrDA
IRDA_TXD E5 IRDA_RXD E7
EDA/SOPC SYSTEM Parallel ADC
D0 K1 D6 P2
D1 K2 D7 P1
D2 L1 D8 R2
D3 L2 D9 Y2
D4 M1 CH G2
D5 M2 CLK H3
EDA/SOPC SYSTEM Parallel DAC
D0 AA4 D7 V1
D1 Y3 D8 V2
D2 U6 D9 U1
D3 U5 CH AC4
D4 T8 CLK U2
D5 R6 WR AB4
D6 W2
153
Signal Name FPGA IO Signal Name FPGA IO
EDA/SOPC SYSTEM Serial ADC
SCLK R1 CS# T3
DOUT Y1
EDA/SOPC SYSTEM Serial DAC
SCLK E19 CS# E21
DIN F19
EDA/SOPC SYSTEM RTC
RTC_RST E12 RTC_IO E11
RTC_CLK F10
EDA/SOPC SYSTEM Temperature Sensor
DS18B20 E10
EDA/SOPC SYSTEM IIC EEPROM
IICSDA E8
IICSCL F8
EDA/SOPC SYSTEM Step Motor
STEP_A M5 STEP_C U7
STEP_B T7 STEP_D Y4
EDA/SOPC SYSTEM DC Motor
MT_PWM AB5
MT_SPEED AB3
EDA/SOPC SYSTEM CLK
CLK A14 24MHz~1Hz
Analog Signal AD Internal Input Port
EDA/SOPC SYSTEM FPGA External In/Out Port
FPGA_INPUT D5
FPGA_OUTPUT C5
154
Signal Name FPGA IO Signal Name FPGA IO
EDA/SOPC SYSTEM Fixed Expension JP4
1 SPR 29-32 VCC
2 NC 33-35 GND
3-8 GND 36 +12V
9 NC 37-38 GND
10 D8 39 NC
11 D7 40 F15
12 D9 41 F14
13 C11 42 G13
14 D11 43 H25
15 C14 44 F11
16 C13 45 AC11
17 NC 46 AB11
18 D4 47 AD10
19 D5 48 AD8
20 C5 49 AC8
21 C6 50 AD7
22 D6 51 AC7
23 C7 52 AB6
24 NC 53 AB13
25 +12V 54 N21
26 NC 55 NC
27-28 GND 56-60 GND
155
Signal Name FPGA IO Signal Name FPGA IO
EDA/SOPC SYSTEM User Expension EXPAND
1 G1 19 E15
2 F2 20 E12
3 F1 21 E11
4 E1 22 F10
5 D2 23 E10
6 D1 24 F12
7 C2 25 AD1
8 B3 26 AC2
9 A3 27 AC1
10 C4 28 AB2
11 A4 29 AB1
12 B4 30 W1
13 B6 31 E17
14 A6 32 E18
15 B7 33-34 -12V
16 E8 35-36 +12V
17 F8 37-38 GND
18 E14 39-40 VCC
156