![]() |
|
|||||||
| 論壇說明 |
|
歡迎您來到『史萊姆論壇』 ^___^ 您目前正以訪客的身份瀏覽本論壇,訪客所擁有的權限將受到限制,您可以瀏覽本論壇大部份的版區與文章,但您將無法參與任何討論或是使用私人訊息與其他會員交流。若您希望擁有完整的使用權限,請註冊成為我們的一份子,註冊的程序十分簡單、快速,而且最重要的是--註冊是完全免費的! 請點擊這裡:『註冊成為我們的一份子!』 |
![]() |
|
|
主題工具 | 顯示模式 |
|
|
#1 | |
|
註冊會員
|
請問有沒有版友知道哪裡有相關的資料可以參考?
引用:
![]() |
|
|
|
送花文章: 23,
|
|
|
#3 (permalink) | |
|
註冊會員
|
引用:
教授說要用VHDL去做~ 以下是VHDL的編碼~ 請問飛鳥大有可以參考的東西嗎?謝謝 語法:
-------------------------------------------------------------------
--實驗名稱:步進馬達實習
--檔案名稱:stepmotor_speed.vhd
--功 能:步進馬達轉速控制
--日 期:2003.8.8
-------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity stepmotor_speed is
port(
clk : in std_logic;
spd : in std_logic_vector(3 downto 0);
step: out std_logic_vector(3 downto 0)
);
end stepmotor_speed;
architecture arch of stepmotor_speed is
signal buf: std_logic_vector (4 downto 0);
signal dly : std_logic;
signal clk_new: std_logic;
signal cnt : std_logic_vector(1 downto 0);
begin
---------- process ---------
process(clk)
begin
if clk'event and clk='1' then
dly <= buf(4);
buf <= buf +('0' & spd);
end if;
end process;
clk_new<=buf(4) xor dly;
process(clk_new)
begin
if clk_new'event and clk_new='1' then
cnt <= cnt+1;
end if;
end process;
step <= "1000" when cnt=0 else
"0100" when cnt=1 else
"0010" when cnt=2 else
"0001";
end arch;
|
|
|
|
送花文章: 23,
|