In: Electrical Engineering
The stepper motor controller will run in full step mode. That means the clockwise sequence will be
Winding1 |
Winding2 |
Winding3 |
Winding4 |
1 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
0 |
1 |
Repeat the pattern |
The counterclockwise sequence will be
Winding1 |
Winding2 |
Winding3 |
Winding4 |
0 |
0 |
0 |
1 |
0 |
0 |
1 |
0 |
0 |
1 |
0 |
0 |
1 |
0 |
0 |
0 |
Repeat the pattern |
Design a stepper motor controller for half step mode in VHDL using Xilinx Vivado.
The following will be your inputs:
CLOCK
RESET
DIRECTION – An input that determine the direction. HIGH for clockwise and LOW for counterclockwise.
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use ieee.std_logic_arith.all;
entity stepper_half_step is
port(
CLOCK : in
STD_LOGIC;
RESET : in
STD_LOGIC;
DIRECTION : in
STD_LOGIC;
Q : out
STD_LOGIC_VECTOR(3 downto 0)
);
end stepper_half_step;
architecture stepper_motor of stepper_half_step is
begin
stepper_motor : process (CLOCK,RESET)
is
variable a : std_logic_vector (2 downto 0) :=
"000";
begin
if (RESET='1')
then
if (rising_edge (CLOCK)) then
a := a + 1;
end if;
end if;
case a is
if (DIRECTION='1') then
when "000" => Q <= "1000";
when "001" => Q <= "0100";
when "010" => Q <= "0010";
when "011" => Q <= "0001";
end if;
if (DIRECTION='0') then
when "100" => Q <= "0001";
when "101" => Q <= "0010";
when "110" => Q <= "0100";
when others => Q <= "1000";
end if;
end case;
end process stepper_motor;
end stepper_motor;