Professional Documents
Culture Documents
Tutorial For Running A Stepper-Motor Using Krypton Board (Wel - Lab, Iit Bombay)
Tutorial For Running A Stepper-Motor Using Krypton Board (Wel - Lab, Iit Bombay)
Tutorial For Running A Stepper-Motor Using Krypton Board (Wel - Lab, Iit Bombay)
STEPPER-MOTOR USING
KRYPTON BOARD
[WEL – LAB,IIT BOMBAY]
Contents:
Design Problem.....
Description.....
Implementation.....
a)To actuate the stepper motor,so that the wheel attached to the
rotor rotates in steps of x degrees.
Description:
00 1.5Hz
01 6Hz
10 24Hz
11 96Hz
Counter:
entity generic_counter is
end generate;
The connections established between the componant instances using the
above statement is as shown below.24 such component instances will be
generated using such simple structural definition.
Multiplexer:
PROCESS (select_in)
BEGIN
CASE select_in IS
WHEN "00" =>
temp_clk <= counter_out(24);
WHEN "01" =>
temp_clk <= counter_out(22);
WHEN "10" =>
temp_clk <= counter_out(20);
WHEN "11" =>
temp_clk <= counter_out(18);
END CASE;
END PROCESS;
Here select_in is a standard logic vector of length 2, that accepts
input from S3 and S4 switches (hence mapped to pins 44 and 43 of
the CPLD respectively)
State Machine:
The state machine is required to generate the wave-drive
stepping sequence. The state-machine shown below is self-
explanatory.
The above state-machine can be defined using the HDL code given
below.
PROCESS (temp_clk, reset) PROCESS (state)
BEGIN BEGIN
IF reset = '1' THEN CASE state IS
state <= s0; WHEN s0 =>
ELSIF (temp_clk'EVENT AND temp_clk output <= "0001";
= '1') THEN WHEN s1 =>
CASE state IS output <= "0010";
WHEN s0=> WHEN s2 =>
IF input = '1' THEN output <= "0100";
state <= s1; WHEN s3 =>
ELSE output <= "1000";
state <= s7;
END IF; END CASE;
WHEN s1=> END PROCESS;
IF input = '1' THEN
state <= s2;
ELSE
state <= s0;
END IF;
WHEN s2=>
IF input = '1' THEN
state <= s3;
ELSE
state <= s1;
END IF;
WHEN s3=>
IF input = '1' THEN
state <= s0;
ELSE
state <= s2;
END IF;
END CASE;
END IF;
END PROCESS;
Driving the stepper motor: