找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 2104|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

新人求助.eda步進(jìn)電機(jī)設(shè)計(jì).大家?guī)兔纯?感謝

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:356821 發(fā)表于 2018-6-23 10:42 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
分頻計(jì)模塊
library ieee;
use ieee. std_logic_1164. All;
use ieee. std_logic_arith. all;
use ieee. std_logic_unsigned. All;
entity freq is
port(clk_sys : in std_logic;

clk_new: out std_logic);

end freq;

architecture one of freq is
signal set : std_logic;

signal cnt : std_logic_vector ( 17 downto 0 );
begin

process ( clk_sys)

begin

if set ='1'then
cnt <="011111111111111111";
elsif clk_sys'event and clk_sys = '1'then

Cnt <= cnt-1;

end if;
end process;
set<= cnt( 17);
clk_new <= cnt ( 16);
end one;
控制器模塊
tibrary ieee;
use ieee. std_logic_1164. All;
use ieee. std_logic_arith. All;
use ieee. std_logic_unsigned. All;
entity step_motor IS

porti( clk : in std_logic;
      Starstop : in std_logic;
      ForRev : in std_logic :'0';

      speed : in std_logic_vector ( 1 domto 0)
      ForLED : out std_logic;

      RevLED : out std_logic;

      coil : out std)_logic_vector (3 domto 0));
end step_motor;

architecture two OF step_motor IS

signal ind_coil: std_logic_vector(3 downto 0):=" 0001";
signal clk_scan : STD_LOGIC;

signal PHASE, DIRECHON : STD_LOGIC;

signal moto:std_logic_vector(3 downto 0);
signal comp : integer range 0 to 2500;

signal osc:std_logic;

begin

Coil<= moto;

P1 : process(clk, osc)

variable delay : integer range 0 to 50;
begin

if(clk'event and clk ='1') then
if delay> = 50 then

delay:=0;osc<= not osc;
else delay :=delay+ 1;
end if;

end if;
if (Osc'event and osc='1') then
case speed is

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表