發表文章

碼表,顯示分與秒VHDL20240608_clock_mmss

圖片
 碼表,顯示分與秒VHDL20240608_clock_mmss https://youtube.com/shorts/CG_sV1ZLDdM library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; use ieee.numeric_std.all; entity VHDL20240608_clock_mmss is port ( clk_4M:in std_logic; rst:in std_logic; clk_555:in std_logic; seg7_out:out std_logic_vector(6 downto 0); seg7_scan:out std_logic_vector(3 downto 0); BCD:out std_logic_vector(3 downto 0); seg7_sec:out std_logic ); end VHDL20240608_clock_mmss; architecture aa of VHDL20240608_clock_mmss is signal cnt1:integer range 0 to 1999:=0; signal clk_2k:std_logic:='0'; signal clk_D5:std_logic:='0'; signal cnt2:std_logic_vector(1 downto 0):="00"; signal m1,m0,s1,s0:std_logic_vector(3 downto 0):="0000"; signal seg7_reg:std_logic_vector(3 downto 0):="0000"; begin process(clk_4M) begin if rising_edge(clk_4M) then if cnt1=1999 then cnt1<=0; clk_2k<=not clk_2k; els...

4位元計數器0000to9999 VHDL20240608_0000to9999

圖片
 4位元計數器0000to9999 VHDL20240608_0000to9999 https://youtube.com/shorts/GxH4fG-qXik library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; use ieee.numeric_std.all; entity VHDL20240608_0000to9999 is port ( clk_4M:in std_logic; rst:in std_logic; clk_555:in std_logic; seg7_out:out std_logic_vector(6 downto 0); seg7_scan:out std_logic_vector(3 downto 0); seg7_sec:out std_logic:='1' ); end VHDL20240608_0000to9999; architecture aa of VHDL20240608_0000to9999 is signal cnt1:integer range 0 to 1999:=0; signal clk_2k:std_logic:='0'; signal cnt2:std_logic_vector(1 downto 0):="00"; signal clk_555_2:std_logic:='0'; signal v0,v1,v2,v3:std_logic_vector(3 downto 0):="0000"; signal seg7_reg:std_logic_vector(3 downto 0):="0000"; begin process(clk_4M,rst) begin if rising_edge(clk_4M) then if cnt1=1999 then cnt1<=0; clk_2k<=not clk_2k; else cnt1...

數位電子乙級第1題CPLD VHDL_20240608_DE1 顯示POSE.

圖片
 數位電子乙級第1題CPLD VHDL_20240608_DE1 顯示POSE. library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; use ieee.numeric_std.all; entity VHDL_20240608_DE1 is port( clk_4M:in std_logic; seg7_out:out std_logic_vector(7 downto 0); seg7_scan:out std_logic_vector(3 downto 0)); end VHDL_20240608_DE1; architecture aa of VHDL_20240608_DE1 is signal cnt1:integer range 0 to 1999:=0; signal cnt2:std_logic_vector(1 downto 0):="00"; signal seg7_v3:std_logic_vector(7 downto 0):="01110011";--P signal seg7_v2:std_logic_vector(7 downto 0):="00111111";--O signal seg7_v1:std_logic_vector(7 downto 0):="01101101";--S signal seg7_v0:std_logic_vector(7 downto 0):="11111001";--E. begin process(clk_4M) begin if rising_edge(clk_4M) then if cnt1=1999 then cnt1<=0; cnt2<=cnt2+1; else cnt1<=cnt1+1; end if; end if; end process; seg7_scan<= "0001...

數位電子乙級第2題腳位E顯示M CPLD 20240606

圖片
 數位電子乙級第2題腳位E顯示M CPLD 20240606 VHDL_20240606_DE2_E_M https://youtube.com/shorts/Ykl7OLIymv0 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; use ieee.numeric_std.all; entity VHDL_20240606_DE2_E_M is port( clk_4M:in std_logic; key_col:in std_logic_vector(2 downto 0); key_row:buffer std_logic_vector(3 downto 0); seg7_out:out std_logic_vector(6 downto 0)); end VHDL_20240606_DE2_E_M; architecture aa of VHDL_20240606_DE2_E_M is signal cnt1:integer range 0 to 1999:=0; signal clk_2k:std_logic:='0'; signal cnt2:std_logic_vector(1 downto 0):="00"; signal temp:std_logic_vector(6 downto 0):="1111111"; signal cnt3:std_logic_vector(6 downto 0):="0000000"; begin process(clk_4M) begin if rising_edge(clk_4M) then if cnt1=1999 then cnt1<=0; clk_2k<=not clk_2k; else cnt1<=cnt1+1; end if; end if; end process; process(clk_2k,key_col) begin ...

數位電子乙級第2題腳位E顯示M LAYOUT 20240605

 數位電子乙級第2題腳位E顯示M LAYOUT 20240605 https://youtu.be/BVg1rqAOhpA 打開chrome 測試參考資料 勞動部網站gov.tw 搜尋 數位電子 下載術科題本PDF 下載到 桌面(老師SD卡),學號(老師class1110XX) 建立新資料夾 DE2_20240605 進入DE2_20240605資料夾 存檔 下載術科library 及燒錄檔 預設的位置 SAVE 進入de2_20240605資料夾 解壓縮至此117002B12.7z 解壓縮至此KiCAD_Library(2).zip 解壓縮至此燒錄檔.7z 進入kicad_library New_Library.kicad_sym改成New_Library20240605.kicad_sym New_Library.pretty資料夾改成New_Library20240605.pretty 回到DE2_20240605資料夾,打開術科題本 腳位E顯示M LAYOUT 在術科題本PDF P4 打開kicad 關掉舊專案 file, close project 建立新專案 file, new project 位置 桌面(老師SD卡),學號(老師class1110XX),DE2_20240605 第一個資料夾名稱為:崗位編號_Layout,放置電路圖與佈線圖設計專案 崗位編號_Layout,在學校設定為座號_Layout 老師座號設為78號 建立資料夾 78_Layout 進入78_Layout資料夾 專案名稱設為 DE2_20240605 SAVE 匯入勞動部資料庫 打開symbol editor file, add library, Global, ok 桌面(老師SD卡),學號(老師class1110XX),DE2_20240605,KiCAD_Library 選New_Library20240605.kicad_sym檔案 open 資料庫置頂 3x4keypad改腳位 左鍵點一下3x4keypad,再點右鍵 save as 3x4_Keypad_mod 7seg_CA改腳位 左鍵點一下7seg,再點右鍵 save as CPLD3064改圖 打開題本PDF P4 腳位E P8 P9 P11 P12 P14 P28 P29 P31 P33 P34 回到C...

PWM 波形產生器VHDL20240601_PWM_Generator

圖片
  https://youtu.be/hOhVjwcwOTY 題目:PWM 波形產生器 設計一個脈衝寬度調變(PWM)波形產生器,具有可變佔空比: 輸入 duty_cycle 為 8 位元數據,代表佔空比的百分比(0-255)。 clk 為時鐘信號, reset 為重置信號。 輸出 pwm_out 為 PWM 波形輸出。 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; use ieee.numeric_std.all; entity VHDL20240601_PWM_Generator is port( duty_cycle:in std_logic_vector(7 downto 0); clk_4M:in std_logic; reset:in std_logic; pwm_out:out std_logic); end VHDL20240601_PWM_Generator; architecture aa of VHDL20240601_PWM_Generator is signal cnt1:std_logic_vector(7 downto 0):="00000000"; begin process(clk_4M, reset) begin if reset='0' then cnt1<="00000000"; elsif rising_edge(clk_4M) then cnt1<=cnt1+1; end if; end process; pwm_out<='1' when cnt1<duty_cycle else '0'; end aa;

4 位元同步計數器VHDL20240601_SyncCounter4Bits

圖片
  https://youtu.be/hAPd00hCYbs 題目:4 位元同步計數器 設計一個 4 位元同步二進制計數器,具有上數和下數功能: 當 reset 為高電位時,計數器重置為 0。 當 up_down 為高電位時,計數器上數;當 up_down 為低電位時,計數器下數。 當計數器到達 15(上數)或 0(下數)時,溢出或借位,循環計數。 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; use ieee.numeric_std.all; entity VHDL20240601_SyncCounter4Bits is port( clk_4M:in std_logic; reset:in std_logic; up_down:in std_logic; seg7_out:out std_logic_vector(6 downto 0); seg7_scan:out std_logic_vector(3 downto 0); seg7_sec:out std_logic:='1'; BCD:buffer std_logic_vector(3 downto 0):="0000"); end VHDL20240601_SyncCounter4Bits; architecture aa of VHDL20240601_SyncCounter4Bits is signal cnt1:integer range 0 to 1999999:=0; signal clk_sec:std_logic:='0'; signal cnt2:integer range 0 to 1999:=0; signal clk_2k:std_logic:='0'; signal cnt3:std_logic_vector(1 downto 0):="00"; signal digit0:std_logic_vector(3 downto 0); signal digit1:std_logic_vector(3 ...

題目:多位元計數器設計VHDL20240601_Counter8Bits

圖片
  https://youtu.be/OyL_oZnofgQ 題目:多位元計數器設計 設計一個 8 位元二進制計數器,具有以下功能: 當 reset 為高電位時,計數器重置為 0。 當 enable 為高電位時,計數器每個時鐘周期遞增 1。 當計數器到達 255 時,溢出並重新開始從 0 計數。 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; use ieee.numeric_std.all; entity VHDL20240601_Counter8Bits is port( clk_4M:in std_logic; reset:in std_logic; enable:in std_logic; BCD:buffer std_logic_vector(7 downto 0):="00000000"); end VHDL20240601_Counter8Bits; architecture aa of VHDL20240601_Counter8Bits is signal cnt1:integer range 0 to 1999999:=0; signal clk_sec:std_logic:='0'; begin process(clk_4M) begin if rising_edge(clk_4M) then cnt1<=cnt1+1; if cnt1=199999 then cnt1<=0; clk_sec<=not clk_sec; end if; end if; end process; process(reset, enable, clk_sec) begin if reset='0' then BCD<="00000000"; elsif rising_edge(clk_sec) then if enable='0' then BCD<=BCD+1; end if; en...

簡單的交通信號燈控制系統VHDL20240601_TrafficLightController

圖片
  https://youtube.com/shorts/5IS8Gvxwax4 題目:簡單的交通信號燈控制系統 說明: 設計一個簡單的交通信號燈控制系統,該系統有三個狀態:綠燈、黃燈和紅燈。信號燈按照固定時間順序切換:綠燈 -> 黃燈 -> 紅燈 -> 綠燈。 要求: 使用有限狀態機 (FSM) 設計交通信號燈控制邏輯。 每個燈的持續時間為: 綠燈:10 秒 黃燈:2 秒 紅燈:8 秒 輸出信號: green : 綠燈信號 (1 為亮,0 為滅) yellow : 黃燈信號 (1 為亮,0 為滅) red : 紅燈信號 (1 為亮,0 為滅) library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; entity VHDL20240601_TrafficLightController is port( clk_4M:in std_logic; reset:in std_logic; seg7_out:out std_logic_vector(6 downto 0); seg7_scan:out std_logic_vector(3 downto 0):="1110"; LED_GYB:out std_logic_vector(2 downto 0):="100"; seg7_sec:out std_logic); end VHDL20240601_TrafficLightController; architecture aa of VHDL20240601_TrafficLightController is signal cnt1:integer range 0 to 1999999:=0; signal clk_sec:std_logic:='0'; type state_type is(green, yellow, red); signal state:state_type:=green; signal cnt2:integer range 0 to 11:=0; begin proces...

VHDL20240527_counter_fsm 有限狀態計數器

圖片
https://youtube.com/shorts/xX-JP7SjK-I?si=XezkWrq6dcKhDNTT  library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; use ieee.numeric_std.all; entity VHDL20240527_counter_fsm is port( clk_4M:in std_logic; reset:in std_logic; start:in std_logic; seg7_scan:out std_logic_vector(3 downto 0):="1110"; state_BCD:out std_logic_vector(2 downto 0):="000"; seg7_out:out std_logic_vector(6 downto 0)); end VHDL20240527_counter_fsm; architecture aa of VHDL20240527_counter_fsm is signal cnt1:integer range 0 to 1999:=0; signal cnt2:integer range 0 to 1999:=0; signal clk_2k:std_logic:='0'; signal clk_sec:std_logic:='0'; type state_type is (IDLE, COUNTING, DONE); signal state:state_type:=IDLE; signal counter:std_logic_vector(3 downto 0):="0000"; begin process(clk_4M) begin if rising_edge(clk_4M) then cnt1<=cnt1+1; if cnt1=1999 then cnt1<=0; clk_2k<=not...