LED數(shù)碼管動(dòng)態(tài)掃描顯示控制器設(shè)計(jì)
【摘要】
當(dāng)多個(gè) LED 數(shù)碼管用靜態(tài)方式顯示時(shí), 需要相當(dāng)多的引出端線,而器件的引腳由于實(shí)際加工水平和使用需求, 往往哪個(gè)僅有極為有限的引腳數(shù)。 利用循環(huán)顯示的方法, 可以通過人眼的視覺暫留, 達(dá)到使用極為有限的引腳使得多個(gè)數(shù)碼管同時(shí)顯示的效果。
【正文】
1. 實(shí)驗(yàn)任務(wù)與原理
1. 1 任務(wù)指標(biāo)
采用掃描方式 LED 數(shù)碼管的動(dòng)態(tài)顯示, 控制好數(shù)碼管之間的延遲,根據(jù)視覺暫留原理對(duì)數(shù)據(jù)進(jìn)行連續(xù)計(jì)數(shù)。
1. 2 功能需求
(1) 能夠通過動(dòng)態(tài)掃描顯示數(shù)據(jù)。
1. 3 原理闡述
(1) LED 數(shù)碼管顯示原理
LED 七段數(shù)碼管原理圖如下, 當(dāng)采用共陰極(采用共陽(yáng)極時(shí)反向) 時(shí), 共陰極接地, 另一管腳接高電平的發(fā)光二極管被點(diǎn)亮。
(2) 動(dòng)態(tài)掃描原理
動(dòng)態(tài)掃描要求在點(diǎn)亮多個(gè)各不同的數(shù)碼管的同時(shí)輸入數(shù)據(jù),但是由于要顯示多個(gè)不同的數(shù)字, 需要在多個(gè)周期內(nèi)才能完成,即將時(shí)間分隔為多個(gè)周期的循環(huán)。 當(dāng)頻率達(dá)到一定程度時(shí)(如1khz), 其延時(shí)可達(dá)到較好的效果, 利用視覺暫留可以達(dá)到動(dòng)態(tài)顯示的目的。
2. 設(shè)計(jì)思路, 方法及方案
2. 1 系統(tǒng)功能需求分析
在時(shí)鐘脈沖 clk 的作用下, 計(jì)數(shù)器開始計(jì)數(shù), 再通過譯碼器生成數(shù)據(jù)選擇器的片選信號(hào), 來控制 LED 管顯示。 同時(shí)選出一路 BC碼數(shù)據(jù), 通過顯示譯碼器控制數(shù)碼管 a-g 管腳和共陰極, 使得每次只有一個(gè)數(shù)碼管在工作。 這樣進(jìn)入 clk 循環(huán)計(jì)數(shù)后, 可以在較高的頻率下輪流顯示。
4. FPGA 模塊程序設(shè)計(jì)
4. 1 提交模塊 VHDL 程序
由于程序較長(zhǎng), 見附錄。
5. 結(jié)束語(yǔ)
5. 1 故障分析處理
動(dòng)態(tài)掃描現(xiàn)實(shí)的優(yōu)勢(shì)是明顯的, 不但減少了引腳, 增加了使用性和可操作性, 而且更加高效。 但是其難點(diǎn)是對(duì)頻率的設(shè)置在不同的環(huán)境和需求下需要仔細(xì)選擇調(diào)試。
5. 2 收獲及改進(jìn)意見
(1) 對(duì) VHDL 和 modesim 有了進(jìn)一步的認(rèn)識(shí)。
(2) 對(duì)波形的調(diào)試仿真有了一定的經(jīng)驗(yàn)。
(3) 了解了 VHDL 語(yǔ)言, 接觸了初級(jí)的的硬件描述性語(yǔ)言。
6. 附錄
---------------------------------------七段譯碼顯示驅(qū)動(dòng)電路-------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 13:35:05 07/04/2011
-- Design Name:
-- Module Name: yimaxianshi - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entityyimaxianshi is
Port ( a : in STD_LOGIC_VECTOR (3 downto 0);
led7s : out STD_LOGIC_VECTOR (7 downto 0));
endyimaxianshi;
architecture Behavioral of yimaxianshi is
begin
process(a)
begin
case a is
when "0000"=>led7s<="01111110";
when "0001"=>led7s<="00110000";
when "0010"=>led7s<="01101101";
when "0011"=>led7s<="01111001";
when "0100"=>led7s<="00110011";
when "0101"=>led7s<="01011011";
when "0110"=>led7s<="01011111";
when "0111"=>led7s<="01110000";
when "1000"=>led7s<="01111111";
when "1001"=>led7s<="01111011";
when others=>led7s<="00000000";
end case;
end process;
end Behavioral;
---------------------------------------------count6-------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 13:49:48 07/04/2011
-- Design Name:
-- Module Name: count6 - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity count6 is
Port ( clk : in STD_LOGIC;
rst : in STD_LOGIC;
en : in STD_LOGIC;
q : out STD_LOGIC_VECTOR (2 downto 0);
co : out STD_LOGIC);
end count6;
architecture Behavioral of count6 is
signalcq:std_logic_vector(2 downto 0);
begin
process(clk,rst,en)
begin
if(rst='0')then
cq<="000";
elsif(clk'event and clk='1')then
if(en='1')then
if(cq="101")then
cq<="000";
elsecq<=cq+1;
end if;
end if;
end if;
q<=cq;
end process;
process(clk)
begin
if(clk'event and clk='1')then
if(cq="101")then
co<='1';
else co<='0';
end if;
end if;
end process;
end Behavioral;
----------------------------------------decode38------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 13:58:13 07/04/2011
-- Design Name:
-- Module Name: decode38 - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity decode38 is
Port ( a : in STD_LOGIC_VECTOR (2 downto 0);
y : out STD_LOGIC_VECTOR (5 downto 0));
end decode38;
architecture Behavioral of decode38 is
begin
process(a)
begin
case a is
when"000"=>y<="000001";
when"001"=>y<="000010";
when"010"=>y<="000100";
when"011"=>y<="001000";
when"100"=>y<="010000";
when"101"=>y<="100000";
when others=>y<="000000";
end case;
end process;
end Behavioral;
--------------------------------------數(shù)據(jù)選擇器--------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 13:49:48 07/04/2011
-- Design Name:
-- Module Name: count6 - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity count6 is
Port ( clk : in STD_LOGIC;
rst : in STD_LOGIC;
en : in STD_LOGIC;
q : out STD_LOGIC_VECTOR (2 downto 0);
co : out STD_LOGIC);
end count6;
architecture Behavioral of count6 is
signalcq:std_logic_vector(2 downto 0);
begin
process(clk,rst,en)
begin
if(rst='0')then
cq<="000";
elsif(clk'event and clk='1')then
if(en='1')then
if(cq="101")then
cq<="000";
elsecq<=cq+1;
end if;
end if;
end if;
q<=cq;
end process;
process(clk)
begin
if(clk'event and clk='1')then
if(cq="101")then
co<='1';
else co<='0';
end if;
end if;
end process;
end Behavioral;
同類文章排行
- LED數(shù)碼管的檢測(cè)
- LED數(shù)碼管故障檢測(cè)檢修
- LED數(shù)顯溫度控制器設(shè)計(jì)論述
- LED大屏幕數(shù)顯裝置在隨流孕育裝置上的應(yīng)用
- LED數(shù)碼管正裝與倒裝結(jié)構(gòu)區(qū)別
- led數(shù)碼管靜態(tài)顯示方式和動(dòng)態(tài)顯示方式
- LED七段數(shù)碼管數(shù)字鐘
- led數(shù)碼管顯示種類簡(jiǎn)介
- LED數(shù)碼管顯示器介紹
- LED數(shù)碼管動(dòng)態(tài)掃描顯示控制器設(shè)計(jì)