Sunday, 28 July 2013

Design of Stepper Motor Driver (Half Step) using Behavior Model (Verilog CODE) -





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


Output Waveform :   Stepper Motor Driver (Half Step).


Verilog CODE -


//-----------------------------------------------------------------------------
//
// Title       : stepper_motor_half_step
// Design      : verilog upload 4
// Author      : Naresh Singh Dobal
// Company     : nsdobal@gmail.com
// Verilog Programs & Exercise with Naresh Singh Dobal
//
//-----------------------------------------------------------------------------
//
// File        : Stepper Motor Driver (Half_step) using Behavior Model.v


module stepper_motor_half_step ( start ,clk ,dout );

output [3:0] dout ;
reg [3:0] dout ;

input start ;
wire start ;
input clk ;
wire clk ;

reg [2:0] m;

initial m = 0;

always @ (posedge (clk)) begin
if (start)
m <= m + 1;
end

always @ (m) begin
case (m)
0 : dout = 4'b1000;
1 : dout = 4'b1100;
2 : dout = 4'b0100;
3 : dout = 4'b0110;
4 : dout = 4'b0010;
5 : dout = 4'b0011;
6 : dout = 4'b0001;
default : dout = 4'b1001;
endcase
end

endmodule

0 comments :

Post a Comment

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes