七段数码显示译码器设计.doc
Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-date七段数码显示译码器设计七段数码显示译码器设计七段数码显示译码器设计一、 实验目的:学习7段数码显示译码器设计,学习VHDL的多层次设计方法。二、实验原理:七段数码管由8个(a,b,c,d,e,f,g,dp)按照一定位置排列的发光二极管构成,通常采取共阴极或者共阳极的设计,将8个二极管的同一极接在一起,通过分别控制另外的8个电极的电平,使二极管导通(发光)或截止(不发光)。七段数码显示译码器的功能就是根据需要显示的字符,输出能够控制七段数码管显示出该字符的编码。三、 实验内容 :1) 用VHDL设计7段数码管显示译码电路,并在VHDL描述的测试平台下对译码器进行功能仿真,给出仿真的波形。-程序:LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;ENTITY SMG ISPORT(A:IN STD_LOGIC_VECTOR(3 DOWNTO 0);LED7S:OUT STD_LOGIC_VECTOR(6 DOWNTO 0);END;ARCHITECTURE ONE OF SMG ISBEGINPROCESS(A)BEGINCASE A ISWHEN"0000"=>LED7S<="0111111"WHEN"0001"=>LED7S<="0000110"WHEN"0010"=>LED7S<="1011011"WHEN"0011"=>LED7S<="1001111"WHEN"0100"=>LED7S<="1100110"WHEN"0101"=>LED7S<="1101101"WHEN"0110"=>LED7S<="1111101"WHEN"0111"=>LED7S<="0000111"WHEN"1000"=>LED7S<="1111111"WHEN"1001"=>LED7S<="1101111"WHEN"1010"=>LED7S<="1110111"WHEN"1011"=>LED7S<="1111100"WHEN"1100"=>LED7S<="0111001"WHEN"1101"=>LED7S<="1011110"WHEN"1110"=>LED7S<="1111001"WHEN"1111"=>LED7S<="1110001"WHEN OTHERS=>NULL;END CASE;仿真波形:2) 数码管显示电路设计利用以上设计的译码器模块,设计一个8位的显示电路。利用时分复用的方式快速轮流点亮8个数码管,在视觉上形成8个数码管同时显示的效果(尽管实际上同一时间只有一个数码管被点亮)。要实现以上功能,就必须按照一定时钟节拍,轮流使译码器输出所需要字符的编码;同时控制数码管的公共电极电平,轮流点亮数码管。备注:在新试验箱中可酌情减少位数实现,新试验箱中管脚查阅教材中附录。程序:LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;USE IEEE.STD_LOGIC_UNSIGNED.ALL;ENTITY VHDL42 ISPORT(CLK:IN STD_LOGIC;S:OUT STD_LOGIC_VECTOR(2 DOWNTO 0);D:IN STD_LOGIC_VECTOR(3 DOWNTO 0);A:OUT STD_LOGIC_VECTOR(6 DOWNTO 0);END VHDL42;ARCHITECTURE ONE OF VHDL42 ISSIGNAL C:STD_LOGIC_VECTOR(2 DOWNTO 0);BEGINP1:PROCESS(CLK)BEGINIF CLK'EVENT AND CLK='1'THEN IF C<"111"THEN C<=C+1;ELSE C<="000"END IF;END IF;S<=C;END PROCESS P1;P2:PROCESS(D)BEGIN CASE D ISWHEN "0000"=> A<="0111111"WHEN "0001"=> A<="0000110"WHEN "0010"=> A<="1011011"WHEN "0011"=> A<="1001111"WHEN "0100"=> A<="1100110"WHEN "0101"=> A<="1101101"WHEN "0110"=> A<="1111101"WHEN "0111"=> A<="0000111"WHEN "1000"=> A<="1111111"WHEN "1001"=> A<="1101111"WHEN "1010"=> A<="1110111"WHEN "1011"=> A<="1111100"WHEN "1100"=> A<="0111001"WHEN "1101"=> A<="1011110"WHEN "1110"=> A<="1111001"WHEN "1111"=> A<="1110001"WHEN OTHERS=> NULL;END CASE;END PROCESS P2;END; 仿真波形:管脚锁定: 信号旧试验箱新试验箱No.2管脚号连接的器件管脚号连接的器件clk43Clk1153CLK2rst35开关2234键2ena30开关1233键1A(6)11SEG g167SEG gA(5)10SEG f166SEG fA(4)9SEG e165SEG eA(3)8SEG d164SEG dA(2)7SEG c163SEG cA(1)6SEG b162SEG bA(0)5SEG a161SEG aS(2)80三-八译码器的控制输入端S(1)79S(0)78-