Search This Blog

Saturday, July 27, 2013

Design of Stepper Motor Driver (Full Step) using Behavior Modeling Style (VHDL Code).






Design of Stepper Motor Driver (Full Step) using Behavior Modeling Style -


Output Waveform  :  Stepper Motor Driver (Full Step).



VHDL Code -


-------------------------------------------------------------------------------
--
-- Title       : stepper_driver_full_step
-- Design      : vhdl_upload2
-- Author      : Naresh Singh Dobal
-- Company     : nsdobal@gmail.com
-- VHDL Programs &  Exercise with Naresh Singh Dobal.
--
-------------------------------------------------------------------------------
--
-- File        : Stepper Motor Driver (full step).vhd



library IEEE;
use IEEE.STD_LOGIC_1164.all;       
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity stepper_driver_full_step is
     port(
         clk : in STD_LOGIC;
         start : in STD_LOGIC;
         dout : out STD_LOGIC_VECTOR(3 downto 0)
         );
end stepper_driver_full_step;


architecture stepper_driver_arc of stepper_driver_full_step is
begin

    stepper : process (clk,start) is
    variable m : std_logic_vector (1 downto 0) := "00";
    begin
        if (start='1') then
            if (rising_edge (clk)) then
                m := m + 1;
            end if;
        end if;
       
        case m is
            when "00" => dout <= "1000";  
            when "01" => dout <= "0100";
            when "10" => dout <= "0010";
            when others => dout <= "0001";
        end case;
    end process stepper;

end stepper_driver_arc;

1 comment:

  1. can u explain the above code and waveform .....how to write testbench for this program........

    ReplyDelete