2016年5月26日 星期四

七段LED顯示解碼器






----
--使用VHDL設計一個七段LED顯示解碼器
--說明:利用VHDL將電路圖以文字敘述方式寫出
--binary x[3..0] ==> y[6..0]=a.b.c.d.e.f.g
--common Anode
--
--------------------------------------------------------------
library ieee;    --宣告要使用的零件庫
use ieee.std_logic_1164.all;
entity bin_7seg is  --宣告元件外部I/O接角的規格

port(
   
     x:in std_logic_vector(3 downto 0); --接腳名稱:輸出入狀態資料形態
     y:out std_logic_vector(6 downto 0) ---y[6]=a y[5]=b....y[0]=g
   
     );

end bin_7seg;

architecture arch of bin_7seg is --描述元件內部的功能

begin

with x select

y<="0000001"when"0000",  --電路內部描述 command

   "1001111"when"0001",  ---a,b,c,d,e,f,g

   "0010010"when"0010",

   "0000110"when"0011",

   "1001100"when"0100",

   "0100100"when"0101",

   "0100000"when"0110",

   "0001111"when"0111",

   "0000000"when"1000",

   "0000100"when"1001",

   "0001000"when"1010",

   "1100000"when"1011",

   "0110001"when"1100",

   "1000010"when"1101",

   "0110000"when"1110",

   "0111000"when"1111",

   "1111111"when others;

end arch ;

沒有留言:

張貼留言

2024產專班 作業2 (純模擬)

2024產專班 作業2  (純模擬) 1) LED ON,OFF,TIMER,FLASH 模擬 (switch 控制) 2)RFID卡號模擬 (buttom  模擬RFID UID(不從ESP32) Node-Red 程式 [{"id":"d8886...