LED4.vhd
资源名称:DS18B20.rar [点击查看]
上传用户:whms_168
上传日期:2022-08-09
资源大小:592k
文件大小:3k
源码类别:
VHDL/FPGA/Verilog
开发平台:
Others
- ---------------------------------------------------------------------------------------------------
- --*************************************************************************************************
- -- CreateDate : 2007-07-12
- -- ModifData : 2007-07-26
- -- Description : LED4 Display
- -- Author : Explorer01
- -- Version : V1.0
- --*************************************************************************************************
- ---------------------------------------------------------------------------------------------------
- -- VHDL library Declarations
- LIBRARY IEEE;
- USE IEEE.std_logic_1164.ALL;
- USE IEEE.std_logic_unsigned.ALL;
- ---------------------------------------------------------------------------------------------------
- ---------------------------------------------------------------------------------------------------
- -- The Entity Declarations
- ENTITY LED4 IS
- PORT
- (
- RESET: IN STD_LOGIC;
- ClockScan: IN STD_LOGIC;
- DATA: IN STD_LOGIC_VECTOR(7 DOWNTO 0);
- Light: OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
- LEDOut: OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
- DigitSelect: OUT STD_LOGIC_VECTOR(3 DOWNTO 0)
- );
- END LED4;
- ---------------------------------------------------------------------------------------------------
- ---------------------------------------------------------------------------------------------------
- -- The Architecture of Entity Declarations
- ARCHITECTURE LED4_arch OF LED4 IS
- SIGNAL LED: STD_LOGIC_VECTOR(3 downto 0);
- -- SIGNAL LED1, LED2: STD_LOGIC_VECTOR(3 downto 0);
- SIGNAL Refresh: STD_LOGIC_VECTOR(1 downto 0);
- BEGIN
- -------------------------------------------------
- -- Encoder
- -- HEX-to-seven-segment decoder
- -- segment encoding
- -- 0
- -- ---
- -- 5 | | 1
- -- --- <- 6
- -- 4 | | 2
- -- ---
- -- 3
- PROCESS( LED, Refresh )
- BEGIN
- IF( Refresh=0 OR Refresh=1 ) THEN
- CASE LED IS
- when "0000"=>LEDOut<= "00111111"; --'0'
- when "0001"=>LEDOut<= "00000110"; --'1'
- when "0010"=>LEDOut<= "01011011"; --'2'
- when "0011"=>LEDOut<= "01001111"; --'3'
- when "0100"=>LEDOut<= "01100110"; --'4'
- when "0101"=>LEDOut<= "01101101"; --'5'
- when "0110"=>LEDOut<= "01111101"; --'6'
- when "0111"=>LEDOut<= "00000111"; --'7'
- when "1000"=>LEDOut<= "01111111"; --'8'
- when "1001"=>LEDOut<= "01101111"; --'9'
- when "1010"=>LEDOut<= "01110111"; --'A'
- when "1011"=>LEDOut<= "01111100"; --'b'
- when "1100"=>LEDOut<= "00111001"; --'C'
- when "1101"=>LEDOut<= "01011110"; --'d'
- when "1110"=>LEDOut<= "01111001"; --'E'
- when "1111"=>LEDOut<= "01110001"; --'F'
- when others=>LEDOut<= "00000000"; --' '
- END CASE;
- ELSIF( Refresh=2 ) THEN
- LEDOut<= "10000000"; --':'
- ELSE
- LEDOut<= "00111001"; --'C'
- END IF;
- END PROCESS;
- -------------------------------------------------
- -- clock
- PROCESS( ClockScan )
- BEGIN
- IF( ClockScan'EVENT AND ClockScan = '1' )THEN
- Refresh <= Refresh + 1;
- END IF;
- END PROCESS;
- -------------------------------------------------
- -- MUX
- LED <=
- DATA(3 DOWNTO 0) when( Refresh=0 ) else
- DATA(7 DOWNTO 4);
- -------------------------------------------------
- -- LED Digit Select
- DigitSelect <=
- "1110" when( Refresh=0 ) else
- "1101" when( Refresh=1 ) else
- "1011" when( Refresh=2 ) else
- "0111";
- -------------------------------------------------
- --
- Light <= NOT DATA;
- END LED4_arch;