亚洲国产日韩欧美在线a乱码,国产精品路线1路线2路线,亚洲视频一区,精品国产自,www狠狠,国产情侣激情在线视频免费看,亚洲成年网站在线观看

發(fā)光二極管走馬燈電路的設(shè)計與實(shí)現(xiàn)實(shí)驗(yàn)(一)

時間:2024-07-26 22:16:08 電子信息工程畢業(yè)論文 我要投稿
  • 相關(guān)推薦

發(fā)光二極管走馬燈電路的設(shè)計與實(shí)現(xiàn)實(shí)驗(yàn)(一)

實(shí)驗(yàn)程序:
 設(shè)計思路:首先用按鍵SW1來控制顯示模式。用狀態(tài)機(jī)來實(shí)現(xiàn)單點(diǎn)移動和幕布式移動。
VHDL程序如下
library ieee;
use ieee.std_logic_1164.all;
entity scan is
 port(clk,reset:in std_logic;
   light:out std_logic_vector(7 downto 0);
   a:in std_logic
  );
end scan;
architecture arch_scan of scan is
TYPE state_type is(s0,s1,s2,s3,s4,s5,s6,s7);
signal state:state_type;
begin
process(a,clk,reset)     ——————process使用嵌套
begin
if(reset='1') then light<="00000000";
elsif(rising_edge(clk)) then
 if a='0' then      ——————‘a(chǎn)’代表BW1的值,控制顯示模式
  case state is    ——————實(shí)現(xiàn)單點(diǎn)移動
   when s0=>
     state<=s1;
     light<="10000000";
   when s1=>
     state<=s2;
     light<="01000000";
   when s2=>
     state<=s3;
     light<="00100000";
   when s3=>
     state<=s4;
     light<="00010000";
   when s4=>
     state<=s5;
     light<="00001000";
   when s5=>
     state<=s6;
     light<="00000100";
   when s6=>
     state<=s7;
     light<="00000010";
   when s7=>
        state<=s0;
      light<="00000001";
  end case;
  else
     case state is     ——————實(shí)現(xiàn)幕布式移動
  when s0=>
    state<=s1;
   light<="00011000";
  when s1=>
    state<=s2;
   light<="00111100";
  when s2=>
   state<=s3;
   light<="01111110";
  when s3=>
   state<=s4;
   light<="11111111";
  when s4=>
   state<=s5;
   light<="01111110";
  when s5=>
   state<=s6;
   light<="00111100";
  when s6=>
   state<=s7;
   light<="00011000";
  when s7=>
   state<=s0;
   light<="00000000"; 
  end case;
   end if;
end if; 
end process;
end arch_scan;

仿真波形如下:

600)makesmallpic(this,600,1800);' src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/ksohtml/wps_clip_image-0.png" width="662" height="244" />


實(shí)驗(yàn)總結(jié)
 仿照上個實(shí)驗(yàn)的狀態(tài)機(jī)設(shè)計,自己寫出了以上的程序。雖然程序簡單,容易寫出,但由于語法不熟,在編寫的過程中走了很多的彎路也出現(xiàn)了較多的錯誤。還好,在老師的指導(dǎo)下,經(jīng)過不段的調(diào)試,改正終于得出了正確的結(jié)果。
 最初,我由于不知道要用嵌套PROCESS,而在一個PROCESS中又加入倆個PROCESS。導(dǎo)致編譯不能通過。這是由于語法不清而犯的錯誤。
 還有就是在寫程序的時候沒有進(jìn)行深入的思考。簡單的認(rèn)為狀態(tài)機(jī)不能實(shí)現(xiàn)幕布式的移動(因?yàn)槲艺J(rèn)為狀態(tài)機(jī)的狀態(tài)不足以表達(dá)幕布式的各個狀態(tài),其實(shí)是足夠的)而使用了兩個循環(huán),這樣就把程序弄的很復(fù)雜。編寫的時候太草率了,應(yīng)該進(jìn)行細(xì)致的思考后再去編寫。
 最后的問題就是,整個編程的過程中,小錯誤總是不段。這里多個‘;’,那里少個字母的。這些小的錯誤雖然在編譯后能夠更正過來,但最好還是希望自己能在以后不要在出現(xiàn)類似的錯誤。
 經(jīng)過這次實(shí)驗(yàn),存在的問題還是老問題——語法不清、不夠細(xì)心。語法的問題是由于沒有具體的學(xué)習(xí)過,又沒有在課下反復(fù)的聯(lián)系。要去系統(tǒng)的學(xué)習(xí)VHDL語言,在近期有點(diǎn)不切實(shí)際,還是要多加練習(xí)。在練習(xí)中熟練 VHDL的語法,而做的多了,也就能避免在細(xì)節(jié)問題上總是出錯。

【發(fā)光二極管走馬燈電路的設(shè)計與實(shí)現(xiàn)實(shí)驗(yàn)(一)】相關(guān)文章:

錯誤檢測與糾正電路的設(shè)計與實(shí)現(xiàn)03-20

ADPCM語音編解碼電路設(shè)計及FPGA實(shí)現(xiàn)03-18

Boost電路的一種軟開關(guān)實(shí)現(xiàn)方法03-18

AGC電路的設(shè)計03-07

用Protel99SE實(shí)現(xiàn)脈沖電路的仿真03-18

換體DMA高速數(shù)據(jù)采集電路的CPLD實(shí)現(xiàn)03-18

一款開關(guān)同步檢波電路的設(shè)計03-07

開關(guān)電源控制及觸發(fā)電路的設(shè)計(一)03-07

IP協(xié)議設(shè)計實(shí)現(xiàn)—重裝模塊(一)03-07