Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17252 Discussions

control stepper using de0 nano

Altera_Forum
Honored Contributor II
1,578 Views

hii.... 

 

how to control a stepper motor that can move 50 degrees?
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
867 Views

I guess you need to calculate, how many pulses you need to send to your motor to move these 50 degree and send them with suitable (low enough) frequency.

0 Kudos
Altera_Forum
Honored Contributor II
867 Views

1.8 degrees in one step<><> 

this my program.,. but still looping. how to stop it in order to move 30 degrees only 

 

 

library IEEE; 

use ieee.std_logic_1164.all; 

entity stepper is 

port ( CLK : in std_logic; 

tombol_arah : in std_logic;  

STEP_D : out std_logic_vector (3 downto 0) 

); 

end stepper;  

Architecture behavioral of stepper is 

signal cnt : integer range 0 to 3; 

signal cnt_1 : integer range 0 to 3; 

begin 

process (CLK) is 

begin 

if (CLK'event and CLK = '1') then 

 

case cnt is 

when 0=> 

STEP_D <= "1001"; 

when 1=> 

STEP_D <= "0001"; 

when 2=> 

STEP_D <= "0011"; 

when 3=> 

STEP_D <= "0010";  

end case; 

end if; 

 

end process; 

 

process (CLK) 

begin 

if(CLK' event and CLK = '1') then 

if cnt = 3 then 

cnt <= 0; 

else 

cnt <= cnt+1;  

end if; 

end if; 

end process; 

end behavioral;
0 Kudos
Altera_Forum
Honored Contributor II
867 Views

1.8 degrees in one step<><> 

this my program.,. but still looping. how to stop it in order to move 30 degrees only 

 

 

library IEEE; 

use ieee.std_logic_1164.all; 

entity steper is 

port ( CLK : in std_logic; 

tombol_arah : in std_logic;  

STEP_D : out std_logic_vector (3 downto 0) 

); 

end steper;  

Architecture behavioral of steper is 

signal cnt : integer range 0 to 3; 

signal cnt_1 : integer range 0 to 3; 

begin 

process (CLK) is 

begin 

if (CLK'event and CLK = '1') then 

 

case cnt is 

when 0=> 

STEP_D <= "1001"; 

when 1=> 

STEP_D <= "0001"; 

when 2=> 

STEP_D <= "0011"; 

when 3=> 

STEP_D <= "0010";  

end case; 

end if; 

 

end process; 

 

process (CLK) 

begin 

if(CLK' event and CLK = '1') then 

if cnt = 3 then 

cnt <= 0; 

else 

cnt <= cnt+1;  

end if; 

end if; 

end process; 

end behavioral;
0 Kudos
Altera_Forum
Honored Contributor II
867 Views

Add another counter, that counts 30 or 50 degrees and when it reaches the certain value it stops rotation. Use enable signal in first process and add a wider counter to the second process.

0 Kudos
Reply