Professional Documents
Culture Documents
BG Thiet Ke Logic So Chuong 5 Cachethongsoungdung - VHDL
BG Thiet Ke Logic So Chuong 5 Cachethongsoungdung - VHDL
BI GING MN
THIT K LOGIC S
Ging vin:
in thoi/E-mail:
B mn:
KTT-Khoa KTT
CHNG 5
THIT K CC H THNG S
NG DNG VHDL
TS. Nguyn Ngc Minh
Khoa KTT1
www.ptit.edu.vn
www.ptit.edu.vn
Nguyn l qut :
+ Ban u LED 1 s c hin th bng cch cp
ngun cho LED1, v d liu s c a vo cc
chn iu khin ca LED1.
+ Sau ln lt cc LED2, LED3,LED4 c hin
th vi d liu tng ng ca tng con LED 7
thanh trong rt nhiu chu k.
+ V c tip tc nh vy cc LED c qut theo
th t.
+ Do s lu nh trn vng mc nn khi ta quan st
gn nh sng lin tc.
www.ptit.edu.vn
www.ptit.edu.vn
www.ptit.edu.vn
www.ptit.edu.vn
www.ptit.edu.vn
Nguyn l qut
10
www.ptit.edu.vn
5.1.2 (tt)
Xy dng
m hnh
Mch iu
khin hin
th ma trn
LED
11
www.ptit.edu.vn
5.1.2 (tt)
process(count_mode8)
begin
case count_mode8 is
when "000" => colum<= "10000000";
when "001" => colum<= "01000000";
when "010" =>
when "011" =>
when "100" =>
when "101" =>
colum<= "00100000";
colum<= "00010000";
colum<= "00001000";
colum<= "00000100";
www.ptit.edu.vn
12
5.1.2 (tt)
row <= a(63 downto 56) when count_mode8 =x"0" else
a(55 downto 48) when count_mode8 =x"1" else
a(47 downto 40) when count_mode8 =x"2"
else
a(39 downto 32) when count_mode8 =x"3"
else
a(31 downto 24) when count_mode8 =x"4"
else
a(23 downto 16) when count_mode8 =x"5"
else
a(15 downto 8) when count_mode8 =x"6"
else
a(7downto 0);
end Behavioral;
13
www.ptit.edu.vn
5.1.2 (tt)
process(clk) --xung 2Kz
begin
if clk='1' and clk'event then
if dem = 12500 then
dem <= 0;
clk2khz <= not clk2khz;
else
dem <= dem +1;
end if;
end if;
end process;
14
www.ptit.edu.vn
www.ptit.edu.vn
www.ptit.edu.vn
5.1.3 (tt)
Lu thut ton
iu khin trong
b m tn
17
www.ptit.edu.vn
5.1.3 (tt)
entity auto_freq_counter is
port( fx : in std_logic;
clk: in std_logic;
Seg : out std_logic_vector(6 downto 0);
dot: out std_logic;
AN : out std_logic_vector(2 downto 0);
Unit : out std_logic_vector(2 downto
0));
end auto_freq_counter;
18
www.ptit.edu.vn
5.1.3 (tt)
else
process (clk)
begin
if clk='1' and clk'event then
if(over1='0') then
case scale is
when "00" =>
if chiatan=x"F423F" then
--clk=10MHz, T=0,1s.
chiatan<=x"00000";
Tch<='1';
else
chiatan<=chiatan+1;
Tch<='0';
end if;
when "01" =>
if chiatan=x"1869F" then
--T=0,1ms;
chiatan<=x"00000";
Tch<='1';
else
chiatan<=chiatan+1;
Tch<='0';
end if;
when "10" =>
if chiatan=x"0270F" then
chiatan<=x"00000";
Tch<='1';
else
chiatan<=chiatan+1;
Tch<='0';
end if;
when others =>
if chiatan=x"F423F" then
chiatan<=x"00000";
Tch<='1';
else
chiatan<=chiatan+1;
Tch<='0';
end if;
--1us
19
www.ptit.edu.vn
5.1.3 (tt)
end case;
else
chiatan<=x"00000";
Tch<='1';
-- Tao xung vao
end if;
process(clk)
end if;
end process;
begin
20
www.ptit.edu.vn
www.ptit.edu.vn
22
www.ptit.edu.vn
23
www.ptit.edu.vn
25
Mch to pixel to
ra cc tn hiu
tung ng vi cc
mu c bn .
tn hiu
video_on
dng kch
hot hay v
hiu ho mn
hnh hin th.
26
www.ptit.edu.vn
www.ptit.edu.vn
S khi mch
iu khin LCD
28
www.ptit.edu.vn
29
K t
LCD
30
www.ptit.edu.vn
K t
LCD
31
www.ptit.edu.vn
32
www.ptit.edu.vn
Ma trn bn phm
33
www.ptit.edu.vn
5.2 (tt)
Lu thut ton
qut bn phm
34
www.ptit.edu.vn
5.2 (tt)
www.ptit.edu.vn
36
37
www.ptit.edu.vn
M bn phm
38
www.ptit.edu.vn
41
www.ptit.edu.vn
42
43
www.ptit.edu.vn