【正文】
n t(3 downto 0):=0000。139。process(reset,c2)variable t:std_logic_vector(7 downto 0):=00000000。 shuju1=t。 end if。039。139。 if t=00000000 then t:=10011001。 else t(3 downto 0):=t(3 downto 0)1。 if sel=10 then if t(3 downto 0)=0000 then t(3 downto 0):=1001。 end if。 else c2=39。c2=39。 end if。 t(7 downto 4):=t(7 downto 4)+1。 then shuju1=00000000。 begin if reset=39。end process。 end if。c1=39。 else alarm=39。c1=39。alarm=39。begin if rising_edge(qs) then t:=t+1。architecture Behavioral of jishu issignal c1,c2:std_logic。 shuju2:out std_logic_vector(7 downto 0))。 01正轉(zhuǎn)10反轉(zhuǎn) alarm:out std_logic。 qs:in std_logic。use 。use 。use 。end Behavioral。 end if。 else buzzer=39。139。 end if。039。 else t:=0。 elsif t50000 then c=39。 if t25000 then c=39。139。 begin if clk39。architecture Behavioral of baojin issignal c:std_logic。 buzzer:out std_logic)。entity baojin is Port ( clk:in std_logic。 Unment the following lines to use the declarations that are provided for instantiating Xilinx primitive ponents.library UNISIM。use 。library IEEE。u6:xs port map (clk=clk,reset=reset,shuju1=load6,shuju2=load7,cs=cs,shift=shift,data_led=data_led)。u4:jishu port map (reset=reset,qs=load4,sel=load3,alarm=load5,shuju1=load6,shuju2=load7)。u2:mcfs port map (clk=clk,reset=reset,speed=load1,pwm_clk=load2)。signal load7:std_logic_vector(7 downto 0)。signal load5:std_logic。signal load3:std_logic_vector(1 downto 0)。signal load1:std_logic_vector(2 downto 0)。 data_led:out std_logic_vector(7 downto 0))。 cs:out std_logic。 shuju1:in std_logic_vector(7 downto 0)。ponent xs is Port ( clk:in std_logic。 buzzer:out std_logic)。ponent baojin is Port ( clk:in std_logic。 shuju2:out std_logic_vector(7 downto 0))。 alarm:out std_logic。 qs:in std_logic。end ponent。 speed:in std_logic_vector(2 downto 0)。ponent mcfs is Port ( clk:in std_logic 。 control:out std_logic_vector(3 downto 0))。 sel:in std_logic_vector(1 downto 0)。速度控制脈沖 clk:in std_logic。正反轉(zhuǎn)信號(hào)輸出端end ponent。 輸入正反轉(zhuǎn)按鍵信號(hào) speed: out std_logic_vector(2 downto 0)。 button1: in std_logic。architecture Behavioral of top isponent key is Port ( reset : in std_logic。 數(shù)碼管位選信號(hào) data_led:out std_logic_vector(7 downto 0))。 報(bào)警信號(hào) cs:out std_logic。 正反選擇 control:out std_logic_vector(3 downto 0)。 1為復(fù)位 0開啟 button1:in std_logic。entity top is Port ( clk:in std_logic。 Unment the following lines to use the declarations that are provided for instantiating Xilinx primitive ponents.library UNISIM。use 。:1 王曉明 電動(dòng)機(jī)的單片機(jī)控制 北京:北京航空航天大學(xué)出版社 2002年第一版 2 . 潘松,黃繼業(yè) .EDA 技術(shù)實(shí)用教程[m].北京: 3.黃智偉 全國(guó)大學(xué)生電子設(shè)計(jì)競(jìng)賽訓(xùn)練教程 北京:電子工業(yè)出版社 2005年第一版 4.南華大學(xué)第六屆全國(guó)電子設(shè)計(jì)競(jìng)賽全體參賽成員 .第六屆電子大賽資料 library IEEE。共有復(fù)位RESET 鍵,步進(jìn)與直流電機(jī)選擇SLECT鍵,正反選擇SHIFT鍵,速度選擇SPEED鍵四個(gè)按鍵 程序流程圖 開始 程序初始化掃描按鍵是否有鍵按下 N Y按鍵處理程序直流電機(jī)控制進(jìn)程步進(jìn)電機(jī)控制進(jìn)程直流驅(qū)動(dòng)模塊步進(jìn)驅(qū)動(dòng)模塊LED顯示步進(jìn)電機(jī)的轉(zhuǎn)速或者頻率直流電機(jī)步進(jìn)電機(jī) :FPGA實(shí)驗(yàn)儀:DPFPGA, 廣州致遠(yuǎn)電子有限公司電機(jī)實(shí)驗(yàn)儀:DP51MOTOR,廣州致遠(yuǎn)電子有限公司數(shù)字萬(wàn)用表:UT101 MULTIMETER 金創(chuàng)電子儀器廠直流穩(wěn)壓電源: DC POWER SUPPLY DF1731SL2A,Zhong Ce Ele