版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、 數(shù)字電路與邏輯設計實驗報告 題目:雙色點陣顯示控制器的設計與實現(xiàn) 班級: 學號: 姓名: 1 實驗要求1.1基本要求:1) 固定紅色顯示一個漢字或圖形,顯示亮度4級可調(diào),用一個btn按鈕實現(xiàn)亮度調(diào)節(jié),亮度變化視覺效果要盡量明顯。2) 用從紅到綠8級漸變色顯示一個固定漢字或圖形。3) 分別用單字循環(huán)顯示、左右滾動顯示、上下滾動顯示三種顯示方式單色顯示四個漢字或圖形,顯示過程中,顯示方式用一個btn按鍵進行切換。4) 顯示的圖形或漢字要盡量飽滿美觀。1.2提高要求: 1) 滾動顯示過程中實現(xiàn)四種顯示顏色的自動變換,顏色變化視覺效果要盡量明顯。 2) 自擬其它功能。2系統(tǒng)設計2.1設計思路本實驗采
2、用自頂向下設計法:從整個系統(tǒng)功能出發(fā),按一定原則將系統(tǒng)劃分為若干子系統(tǒng),再將每個子系統(tǒng)分為若干功能模塊,然后實現(xiàn)所要求的的功能。總體是通過分頻、按鍵控制、掃描控制等模塊實現(xiàn)上述功能,通過占空比來改變色彩,實現(xiàn)八級漸變色,通過掃描頻率的改變和信號的占空比實現(xiàn)亮度的調(diào)節(jié),通過行掃描和列掃描的不同實現(xiàn)左右滾動顯示和上下滾動顯示。由于按鍵動作的時刻和按下的時間長短是隨機的,并且存在由開關簧片反彈導致的電平抖動,所以還要為每個按鍵開關設置一個消抖和同步電路,這樣才能保證按鍵的準確性。2.2總體設計框圖1) 總體結構框圖顯示不同的文字或者圖案選擇漢字或圖形選擇顯示模式選擇亮度2) ASM圖開始選擇圖形或文
3、字循環(huán)顯示?no yes調(diào)亮顯示?選擇顯示方式 yes固定紅色調(diào)節(jié)亮度case1? no yes從紅到綠八級變色nocase2?yes左右滾動顯示csae3no上下滾動顯示循環(huán)顯示四種顏色自動變換 點陣屏顯示如圖所示:開始由按鍵選擇模式,是單個漸變色顯示,還是循環(huán)顯示,還是可改變亮度顯示,在執(zhí)行的同時檢查是否按下reset鍵,如果reset鍵被按下,那么將對系統(tǒng)進行復位。2.3模塊劃分點陣顯示模塊掃描控制模塊分頻模塊邏輯劃分框圖控制器點陣顯示屏分頻電路CP按鍵選擇顯示模式:循環(huán),滾動按鍵選擇所要選擇的漢字或圖形按鍵調(diào)節(jié)亮度按鍵消抖動同步電路如圖所示:系統(tǒng)主要分成3個模塊:分頻模塊針對不同的模式
4、進行分頻,掃描控制模塊通過行掃描或者列掃描來控制循環(huán)顯示的方式,點陣顯示模塊主要是響應不同模式下的點陣顯示方式及圖形。3 仿真波形及其分析如圖所示 當摁下clear鍵時各信號復位,當模式按鍵按下并計數(shù)時,信號輸出對應各個模式,桐鄉(xiāng)當亮度模式按下時,信號的占空比改變。4源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity dianzhen isport(clk_in ,clear,btn1,btn2,btn3: in std_l
5、ogic; -定義時鐘、復位、按鍵1、2、3colred ,colgreen ,rowout : out std_logic_vector(7 downto 0); -列信號行信號輸出 bout0,bout1,bout2,bout3: out std-logic -防抖動信號 ); end dianzhen;architecture behave of dianzhen is signal stared ,stagre : std_logic_vector(3 downto 0); signal cred ,row ,cgreen,redtm,gretm : std_logic_vector(
6、7 downto 0); signal smode,sligc,scc : std_logic_vector(1 downto 0); signal zred ,zgreen : std_logic_vector(2 downto 0); signal stm : std_logic_vector(5 downto 0); signal cnt :integer range 0 to 799999; signal xtx :integer range 0 to 99999; signal gun :integer range 0 to 1023999999; signal cnt0,cnt1,
7、cnt2,cnt3: integer range 0 TO 7; signal data0,data1,data2,data3: std_logic; begin process(clk_in,btn1) -brn1鍵防抖動 beginif(clk_in'event and clk_in = '0') thenif(data0 /= btn1) then cnt0 <= cnt0 + 1;elsecnt0 <= 0;end if;if cnt0 >= 5 thendata0 <= btn1;cnt0 <= 0;end if;end if;b
8、out0 <= data0;end process;process(clk_in,btn2) -btn2鍵防抖動beginif (clk_in'event and clk_in = '0') thenif(data1 /= btn2) THEN cnt1 <= cnt1 + 1;elsecnt1 <= 1;end if;if cnt1 >= 5 thendata1 <= btn2;cnt1 <= 1;end if ;end if ;bout1 <= data1;end process;process(clk_in,btn3)-b
9、utton2 -btn3鍵防抖動beginif (clk_in'event and clk_in = '0') thenif(data2 /= btn3) thencnt2 <= cnt2 + 1;elsecnt2 <= 0;end if;if cnt2 >= 5 thendata2 <= btn3;cnt2 <= 0;end if;end if;bout2 <= data2;end process; p1:process(clk_in,btn1,btn2,btn3,clear,stared,stagre,zred,zgreen,cn
10、t,gun,xtx) -分頻begin if clear='1' then -復位模式 smode<="00" sligc<="00" scc<="00" else if (btn1'event and btn1='1' )then -模式選擇、亮度選擇、循環(huán)選擇 smode<=smode+1; end if; if (btn2'event and btn2='1') then sligc<=sligc+1; end if; if (btn3
11、'event and btn3='1') then scc<=scc+1; end if; end if;if (clk_in'event and clk_in='1') then -模式選擇分頻器if cnt=99999 thencnt<=cnt+1;row<="11111110"elsif cnt=199999 thencnt<=cnt+1;row<="11111101"elsif cnt=299999 thencnt<=cnt+1;row<="111
12、11011"elsif cnt=399999 thencnt<=cnt+1;row<="11110111"elsif cnt=499999 thencnt<=cnt+1;row<="11101111"elsif cnt=599999 thencnt<=cnt+1;row<="11011111"elsif cnt=699999 thencnt<=cnt+1;row<="10111111"elsif cnt=799999 thencnt<=cnt+1;ro
13、w<="01111111"else cnt<=cnt+1; end if; if xtx=12499 then -亮度選擇分頻器 xtx<=xtx+1; zred<="000" zgreen<="000" elsif xtx=24999 then xtx<=xtx+1; zred<="001" zgreen<="001" elsif xtx=37499 then xtx<=xtx+1; zred<="010" zgr
14、een<="010" elsif xtx=49999 then xtx<=xtx+1; zred<="011" zgreen<="011"elsif xtx=62499 then xtx<=xtx+1; zred<="100" zgreen<="100" elsif xtx=74999 then xtx<=xtx+1; zred<="101" zgreen<="101" elsif xtx=874
15、99 then xtx<=xtx+1; zred<="110" zgreen<="110" elsif xtx=99999 then xtx<=xtx+1; zred<="111" zgreen<="111" else xtx<=xtx+1; end if; if gun=31999999 then -掃描分頻器 gun<=gun+1; stm<="000001" elsif gun=63999999 then gun<=gun+1;
16、stm<="000000" elsif gun=95999999 then gun<=gun+1; stm<="000010" elsif gun=127999999 then gun<=gun+1; stm<="000000" elsif gun=159999999 then gun<=gun+1; stm<="000011" elsif gun=191999999 then gun<=gun+1; stm<="000000" elsif
17、gun=223999999 then gun<=gun+1; stm<="000100" elsif gun=255999999 then gun<=gun+1; stm<="000000" elsif gun=287999999 then gun<=gun+1; stm<="000101" elsif gun=319999999 then gun<=gun+1; stm<="000000" elsif gun=351999999 then gun<=gun+1
18、; stm<="000110" elsif gun=383999999 then gun<=gun+1; stm<="000000" elsif gun=415999999 then gun<=gun+1; stm<="000111" elsif gun=447999999 then gun<=gun+1; stm<="000000" elsif gun=479999999 then gun<=gun+1; stm<="001000" els
19、if gun=511999999 then gun<=gun+1; stm<="000000" elsif gun=543999999 then gun<=gun+1; stm<="001001" elsif gun=575999999 then gun<=gun+1; stm<="000000" elsif gun=607999999 then gun<=gun+1; stm<="001010" elsif gun=639999999 then gun<=gu
20、n+1; stm<="000000" elsif gun=671999999 then gun<=gun+1; stm<="001011" elsif gun=703999999 then gun<=gun+1; stm<="000000" elsif gun=735999999 then gun<=gun+1; stm<="001100" elsif gun=767999999 then gun<=gun+1; stm<="000000"
21、elsif gun=799999999 then gun<=gun+1; stm<="001101" elsif gun=831999999 then gun<=gun+1; stm<="000000" elsif gun=863999999 then gun<=gun+1; stm<="001110" elsif gun=895999999 then gun<=gun+1; stm<="000000" elsif gun=927999999 then gun<
22、=gun+1; stm<="001111" elsif gun=959999999 then gun<=gun+1; stm<="000000" elsif gun=991999999 then gun<=gun+1; stm<="010000" elsif gun=1023999999 then gun<=gun+1; stm<="000000"end if; end if; case stared is -紅色信號控制 when "0000" =&g
23、t;redtm<="00000000" when "0001" => case zred is when "000"=>redtm<="11111111" when others=>redtm<="00000000" end case; when "0010"=> case zred is when "000"=>redtm<="11111111" when "001&qu
24、ot;=>redtm<="11111111" when others=>redtm<="00000000" end case; when "0011"=> case zred is when "000"=>redtm<="11111111" when "001"=>redtm<="11111111" when "010"=>redtm<="11111111&qu
25、ot; when others=>redtm<="00000000" end case;when "0100"=> case zred is when "000"=>redtm<="11111111" when "001"=>redtm<="11111111" when "010"=>redtm<="11111111" when "011"=>redtm&l
26、t;="11111111" when others=>redtm<="00000000" end case; when "0101"=> case zred is when "111"=>redtm<="00000000" when "110"=>redtm<="00000000" when "101"=>redtm<="00000000" when others
27、=>redtm<="11111111" end case;when "0110"=> case zred is when "111"=>redtm<="00000000" when "110"=>redtm<="00000000" when others=>redtm<="11111111" end case;when "0111"=> case zred is when &q
28、uot;111"=>redtm<="00000000" when others=>redtm<="11111111" end case; when "1000"=>redtm<="11111111" when others =>redtm<="11111111" end case; case stagre is -綠色信號控制 when "0000" =>gretm<="00000000"
29、; when "0001" => case zgreen is when "000"=>gretm<="11111111" when others=>gretm<="00000000" end case; when "0010"=> case zgreen is when "000"=>gretm<="11111111" when "001"=>gretm<="111
30、11111" when others=>gretm<="00000000" end case; when "0011"=> case zgreen is when "000"=>gretm<="11111111" when "001"=>gretm<="11111111" when "010"=>gretm<="11111111" when others=>gretm
31、<="00000000" end case;when "0100"=> case zgreen is when "000"=>gretm<="11111111" when "001"=>gretm<="11111111" when "010"=>gretm<="11111111" when "011"=>gretm<="11111111"
32、 when others=>gretm<="00000000" end case; when "0101"=> case zgreen is when "111"=>gretm<="00000000" when "110"=>gretm<="00000000" when "101"=>gretm<="00000000" when others=>gretm<="
33、11111111" end case;when "0110"=> case zgreen is when "111"=>gretm<="00000000" when "110"=>gretm<="00000000" when others=>gretm<="11111111" end case;when "0111"=> case zgreen is when "111"=>
34、;gretm<="00000000" when others=>gretm<="11111111" end case; when "1000"=>gretm<="11111111" when others =>gretm<="11111111" end case; end process; p2:process(smode,sligc,row,scc,stm) - 單字顯示“手”begin case smode iswhen "00"
35、=>case sligc is when "00" =>stared<="1000"when "01" =>stared<="0110"when "10" =>stared<="0011"when "11" =>stared<="0001"when others =>stared<="1000"end case;case row iswhen &quo
36、t;11111110"=>cred<="00001000"when "11111101"=>cred<="00011000"when "11111011"=>cred<="00101000"when "11110111"=>cred<="01111110"when "11101111"=>cred<="11111111"when "110
37、11111"=>cred<="00001000"when "10111111"=>cred<="00011000"when "01111111"=>cred<="00001000"when others=>cred<="00000000"end case; when "01"=> case row iswhen "11111110"=>stared<="
38、;0111"stagre<="0000"cred<="00001000"cgreen<="00001000"when "11111101"=>stared<="0110"stagre<="0001"cred<="00011000"cgreen<="00011000"when "11111011"=>stared<="0101"s
39、tagre<="0010"cred<="00101000"cgreen<="00101000"when "11110111"=>stared<="0100"stagre<="0011"cred<="01111110"cgreen<="01111110"when "11101111"=>stared<="0011"stagre<=&q
40、uot;0100"cred<="11111111"cgreen<="11111111"when "11011111"=>stared<="0010"stagre<="0101"cred<="00001000"cgreen<="00001000"when "10111111"=>stared<="0001"stagre<="0110&quo
41、t;cred<="00011000"cgreen<="00011000"when "01111111"=>stared<="0000"stagre<="0111"cred<="00001000"cgreen<="00001000"when others=>stared<="1000"stagre<="0000"cred<="00000000&
42、quot;cgreen<="00000000"end case;when "10"=> -單字左右滾動顯示“手” case scc iswhen "00"=> case stm is when"000001"=> stared<="0111"stagre<="0000" case row is -1when "11111110"=>cred<="00001000"cgreen<=&q
43、uot;00001000"when "11111101"=>cred<="00011000"cgreen<="00011000"when "11111011"=>cred<="00101000"cgreen<="00101000"when "11110111"=>cred<="01111110"cgreen<="01111110"when "1
44、1101111"=>cred<="11111111"cgreen<="11111111"when "11011111"=>cred<="00001000"cgreen<="00001000"when "10111111"=>cred<="00011000"cgreen<="00011000"when "01111111"=>cred<=&qu
45、ot;00001000"cgreen<="00001000"when others=>cred<="00000000"cgreen<="00000000"end case;when"000010"=>stared<="0110"stagre<="0001" case row is -2when "11111110"=>cred<="00010000"cgreen<=&
46、quot;00010000"when "11111101"=>cred<="00110000"cgreen<="00110000"when "11111011"=>cred<="01010000"cgreen<="01010000"when "11110111"=>cred<="11111100"cgreen<="11111100"when "
47、11101111"=>cred<="11111111"cgreen<="11111111"when "11011111"=>cred<="00010000"cgreen<="00010000"when "10111111"=>cred<="00110000"cgreen<="00110000"when "01111111"=>cred<=&q
48、uot;00010000"cgreen<="00010000"when others=>cred<="00000000"cgreen<="00000000"end case;when"000011"=> -3stared<="0101"stagre<="0010" case row is when "11111110"=>cred<="00100000"cgreen<
49、="00100000"when "11111101"=>cred<="01100000"cgreen<="01100000"when "11111011"=>cred<="10100000"cgreen<="10100000"when "11110111"=>cred<="11111001"cgreen<="11111001"when &quo
50、t;11101111"=>cred<="11111111"cgreen<="11111111"when "11011111"=>cred<="00100000"cgreen<="00100000"when "10111111"=>cred<="01100000"cgreen<="01100000"when "01111111"=>cred<=
51、"00100000"cgreen<="00100000"when others=>cred<="00000000"cgreen<="00000000"end case;when"000100"=> -4stared<="0100"stagre<="0011" case row is when "11111110"=>cred<="01000000"cgreen&l
52、t;="01000000"when "11111101"=>cred<="11000000"cgreen<="11000000"when "11111011"=>cred<="01000001"cgreen<="01000001"when "11110111"=>cred<="11110011"cgreen<="11110011"when &q
53、uot;11101111"=>cred<="11111111"cgreen<="11111111"when "11011111"=>cred<="01000000"cgreen<="01000000"when "10111111"=>cred<="11000000"cgreen<="11000000"when "01111111"=>cred<
54、;="01000000"cgreen<="01000000"when others=>cred<="00000000"cgreen<="00000000"end case;when"000101"=> -5stared<="0011"stagre<="0100" case row is when "11111110"=>cred<="10000000"cgreen
55、<="10000000"when "11111101"=>cred<="10000001"cgreen<="10000001"when "11111011"=>cred<="10000010"cgreen<="10000010"when "11110111"=>cred<="11100111"cgreen<="11100111"when
56、"11101111"=>cred<="11111111"cgreen<="11111111"when "11011111"=>cred<="10000000"cgreen<="10000000"when "10111111"=>cred<="10000001"cgreen<="10000001"when "01111111"=>cred&
57、lt;="10000000"cgreen<="10000000"when others=>cred<="00000000"cgreen<="00000000"end case; when"000110"=> -6stared<="0010"stagre<="0101" case row is when "11111110"=>cred<="00000001"cgr
58、een<="00000001"when "11111101"=>cred<="00000011"cgreen<="00000011"when "11111011"=>cred<="00000101"cgreen<="00000101"when "11110111"=>cred<="11001111"cgreen<="11001111"wh
59、en "11101111"=>cred<="11111111"cgreen<="11111111"when "11011111"=>cred<="00000001"cgreen<="00000001"when "10111111"=>cred<="00000011"cgreen<="00000011"when "01111111"=>cr
60、ed<="00000001"cgreen<="00000001"when others=>cred<="00000000"cgreen<="00000000"end case;when"000111"=> -7stared<="0001"stagre<="0110" case row is when "11111110"=>cred<="00000010"c
61、green<="00000010"when "11111101"=>cred<="00000110"cgreen<="00000110"when "11111011"=>cred<="00001010"cgreen<="00001010"when "11110111"=>cred<="10011111"cgreen<="10011111"
62、when "11101111"=>cred<="11111111"cgreen<="11111111"when "11011111"=>cred<="00000010"cgreen<="00000010"when "10111111"=>cred<="00000110"cgreen<="00000110"when "01111111"=>
63、cred<="00000010"cgreen<="00000010"when others=>cred<="00000000"cgreen<="00000000"end case;when"001000"=> -8stared<="0000"stagre<="0111" case row is when "11111110"=>cred<="00000100"
64、;cgreen<="00000100"when "11111101"=>cred<="00001100"cgreen<="00001100"when "11111011"=>cred<="00010100"cgreen<="00010100"when "11110111"=>cred<="00111111"cgreen<="00111111&quo
65、t;when "11101111"=>cred<="11111111"cgreen<="11111111"when "11011111"=>cred<="00000100"cgreen<="00000100"when "10111111"=>cred<="00001100"cgreen<="00001100"when "01111111"=&g
66、t;cred<="00000100"cgreen<="00000100"when others=>cred<="00000000"cgreen<="00000000"end case;when others=>cred<="00000000"cgreen<="00000000"end case; when "01"=> -左右滾動顯示“郵電大學” case stm is when"000001
67、"=> stared<="0111"stagre<="0000" case row is -1幀when "11111110"=>cred<="00100000"cgreen<="00100000"when "11111101"=>cred<="00100111"cgreen<="00100111"when "11111011"=>cred<="11111110"cgreen<="11111110"when "11110111"=>cred<="10101100"cgreen<="10101100"when
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024年公司資產(chǎn)轉(zhuǎn)讓協(xié)議模板
- 2024年度旅游大巴租賃服務協(xié)議
- 2024年員工派遣服務協(xié)議
- 2024賽季足球場租賃協(xié)議范本
- 2024年建設工程委托代理協(xié)議
- 2024年科技支持服務協(xié)議樣本
- 2024隔音設施安裝及施工協(xié)議樣本
- 店鋪租賃經(jīng)營規(guī)范協(xié)議2024年
- 2024年采購協(xié)議模板與協(xié)議細則
- 2024年店面房租賃協(xié)議樣本
- 2023年工程項目全過程跟蹤審計實施方案(4篇)
- 公寓de全人物攻略本為個人愛好而制成如需轉(zhuǎn)載注明信息
- 數(shù)據(jù)中心機房建設方案課件
- 二年級群文閱讀:讀:童話中的不可思議-課件
- Citect軟件培訓教程課件
- 產(chǎn)品質(zhì)量法-產(chǎn)品質(zhì)量法課件
- 水資源管理知識競賽參考題(100題)
- 四年級上冊道德與法治4《少讓父母為我操心》教學反思三篇
- 護理工作中的語言溝通課件
- 沖擊鉆施工工藝及步驟
- 環(huán)保知識競賽考試題庫200題(含答案)
評論
0/150
提交評論