freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于fpga的vhdl編寫的電子時鐘-在線瀏覽

2025-01-11 06:25本頁面
  

【正文】 led : out std_logic_vector (6 downto 0) )。 end my_pkg。為了節(jié)省電路耗電,輸出顯示采用四合一七段顯示器來顯示分與秒共4個數(shù)字,另外2個數(shù)字的小時顯示也采用四合一七段顯示器來顯示,只是讓其中2個數(shù)字不用即可。由于需要1024Hz的時鐘掃描信號,為簡化設(shè)計之便,本系統(tǒng)輸入時鐘的信號直接采用信號發(fā)生器的1024Hz信號。 div1024組件程序代碼library ieee。 use 。 entity div1024 is port( clk: in std_logic。 1hz output signal end 。 count from 0 to 1023local signal begin process for dividing by 1024 process (clk) begin if rising_edge(clk) then count=count+1。 else f1hz=’0’。 end if。 end arch。由圖42可知,信號f1hz是由clk除以1024所得的對稱脈沖信號。雖然十進制僅需2位的位矢量,但為統(tǒng)一以后的七段顯示器輸出顯示的需要,這里是以4位的位矢量表示的。秒數(shù)的計數(shù)以1Hz的輸入為觸發(fā)信號,分數(shù)的計數(shù)以秒數(shù)的進位輸出full_sec作為觸發(fā)。 use 。 use 。from 1hz input clock or the full_index of second/minute rst: in std_logic。 full: out std_logic)。 architecture arch of count60 is input:rst,carry output:times,full signal time : integer range 0 to 59。 full=’0’。over 60 full=’1’。keep counting full=’0’。 end if。 times=time。 設(shè)定clk與reset兩個系統(tǒng)輸入信號后,可觀察到系統(tǒng)輸出信號ones與tens的波形,在計數(shù)值達到59以后,即進位到00(60),如圖43所示。因此個位數(shù)信號one(0~9)與十位數(shù)信號ten(0~2)先以整數(shù)形式出現(xiàn),計算完成后再轉(zhuǎn)換成位矢量形式(信號ones與tens),便于以后轉(zhuǎn)成LED顯示碼。個位數(shù)的進位歸零在十進制為2時,必須在one等于3時進位,同時送出進位指針full=’1’,1小時后將指針歸零。 count24組件程序代碼 library ieee。 use 。 entity count24 is port( carry: in std_logic。initialization times: out integer range 0 to 23。 carry_out signal end count24。 begin process for 60 seconds counting process (rst,carry) begin if rst=’1’ then time = 0。 elsif rising_edge(carry) then if time=23 then time=0。carry_out signal else time= time + 1。 end if。 end process。 end arch。圖4-4 alarm_set組件 為了設(shè)定鬧鐘,我們設(shè)計了一個目標時間調(diào)整程序。將alarm的指撥開關(guān)轉(zhuǎn)成on時,6個數(shù)字即顯示00:00:00,以等待輸入。調(diào)分鍵與調(diào)時鍵的動作原理相同,此時ok指撥開關(guān)仍在off狀態(tài)。 use 。 use 。system clock 1hz alarm,ok: in std_logic。 keep pushing to declare second tuning min_tune: in std_logic。 keep pushing to declare hour tuning sec,min: out integer range 0 to 59。 end。 signal hour_tmp: integer range 0 to 23。 min_tmp=0。 elsif rising_edge(hz1) then if alarm=’1’ and ok=’0’ then if sec_tune=’1’ then if sec_tmp=59 then sec_tmp=0。 end if。 if min_tune=’1’ then if min_tmp=59 then min_tmp=0。 end if。 if hour_tune=’1’ then if hour_tmp=23 then hour_tmp=0。 end if。 else null。 end if。 sec=sec_tmp。 hour=hour_tmp。 當alarm=’1’且ok=’0’時,按住sec_tune,秒數(shù)則逐秒增加,再按住min_tune,分數(shù)逐分增加,按住hour_tune亦同;當ok=’1’時,則停止設(shè)定,顯示時間便回到正常計時。 圖4-5 stop_watch組件 為了設(shè)定計時器,我們設(shè)計了一個目標時間調(diào)整程序。將alarm的指撥開關(guān)轉(zhuǎn)成on時,6個數(shù)字即顯示00:00:00,以等待輸入。調(diào)分鍵與調(diào)時鍵的動作原理相同,此時ok指撥開關(guān)仍在off狀態(tài)。 stop_watch組件程序代碼 libray and package declaraction library ieee。 use 。 input and output pins declaraction entity stop_watch is port(rst,hz1: in std_logic。 keep pushing to declare stop setting ok: in std_logic。pushing button to tune seconds min_tune: in std_logic。pushing button to tune hours stop_sec,stop_min: out integer range 0 to 59。 index: out std_logic。 end stop_watch。 signal a_hour: integer range 0 to 23。 disp=’0’。 else a_sec=a_sec + 1。 end if。 else a_min=a_min + 1。 end if。 elsif stop=’1’ and ok=’1’then down counting if a_sec=0 then if a_min=0 then if a_hour=0 then index=’1’。 else a_hour=a_hour 1。 a_sec=59。 else a_min=a_min 1。 end if。 index=’0’。 end if。 end if。 end process。 stop_min=a_min。 end arch。信號仿真結(jié)果如圖46所示。 i60bcd組件程序代碼 the ieee standard 1164 package, declares std_logic, rising_edge(), etc. library ieee。 use 。 entity i60bcd is port (interg : in integer range 0 to 59。 decimal bit one : out std_logic_vector (3 downto 0) )。 architecture arch of i60bcd is begin process(interg) begin case interg is when 0|10|20|30|40|50 = one=0000。 when 2|12|22|32|42|52 = one=0010。 when 4|14|24|34|44|54 = one=0100。 when 6|16|26|36|46|56 = one=0110。 when 8|18|28|38|48|58 = one=1000。 when others = one=1110。 case interg is when 0|1|2|3|4|5|6|7|8|9 = ten=0000。 when 20|21|22|23|24|25|26|27|28|29 = ten=0010。 when 40|41|42|43|44|45|46|47|48|49 = ten=0100。 when others = ten=1110。 end process。 信號仿真結(jié)果如圖47所示。圖4-7 i24bcd組件 同理,設(shè)計一個查表程序來將小時數(shù)0~23共24個整數(shù)轉(zhuǎn)換成二進制編碼的十進制(BCD)表示,以便將來轉(zhuǎn)換成七段顯示器格式輸出。 i24bcd組件程序代碼 the ieee standard 1164 package, declares std_logic, rising_edge(), etc. library ieee。 use 。 entity i24bcd is port (interg : in integer range 0 to 23。decimal bit one : out std_logic_vector (3 downto 0) )。 architecture arch of i24bcd is begin process(interg) begin case interg is when 0|10|20 = one=0000。 when 2|12|22 = one=0010。 when 4|14 = one=0100。 when 6|16 = one=0110。 when 8|18 = one=1000。 when others = one=1110。 case interg is when 0|1|2|3|4|5|6|7|8|9 = ten=0000。 when 20
點擊復制文檔內(nèi)容
研究報告相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1