Interfacing Stepper motor with 8051

38,992 views

Published on

Interfacing Stepper motor with 8051

Published in: Education
7 Comments
62 Likes
Statistics
Notes
No Downloads
Views
Total views
38,992
On SlideShare
0
From Embeds
0
Number of Embeds
234
Actions
Shares
0
Downloads
0
Comments
7
Likes
62
Embeds 0
No embeds

No notes for slide

Interfacing Stepper motor with 8051

  1. 1. Interfacing Stepper Motor with 8051<br />www.pantechsolutions.net<br />
  2. 2. <ul><li>A stepper motor (or step motor) is a brushless synchronous electric motor that can divide a full rotation into a large number of steps.
  3. 3. The motor's position can be controlled precisely without any feedback mechanism, as long as the motor is carefully sized to the application.
  4. 4. Stepper motors are similar to switched reluctance motor (which are very large stepping motors with a reduced pole count, and generally are closed-loop
  5. 5. The stepper motor can be interfaced with the 8051 using l293d connected to p1.0,p1.2,p1.3,p1.4
  6. 6. Stepper motor two types of step sequence 1) full step and 2) half step sequence
  7. 7. In the full step sequence, two coils are energized at the same time and motor shaft rotates. The order in which coils has to be energized is given in the table below</li></ul>WHAT IS STEPPER MOTOR ?<br />
  8. 8. Full step and half step sequence<br />In the full step sequence, two coils are energized at the same time and motor shaft rotates. The order in which coils has to be energized is given in the table below.<br />In Half mode step sequence, motor step angle reduces to half the angle in full mode. So the angualar resolution is also increased i.e. it becomes double the angular resolution in full mode. Also in half mode sequence the number of steps gets doubled as that of full mode. Half mode is usually preffered over full mode. Table below shows the pattern of energizing the coils.<br />
  9. 9. Full step sequence<br />
  10. 10. Full step sequence<br />
  11. 11. Half step sequence<br />
  12. 12. Confidential © Copyright 2008 Pantech solutions Pvt Ltd<br />Stepper motor interfacing<br />
  13. 13. Half step sequence<br />
  14. 14.     org0Hstepper equP1main:        mov stepper,#0CH        acall delay        mov stepper,#06H        acall delay        mov stepper,#03H        acall delay        mov stepper,#09H        acall delay        sjmp main<br />STEPPER MOTOR ASSEMBLY CODE<br />
  15. 15. delay:        mov r7,#4wait2:        mov r6,#0FFHwait1:        mov r5,#0FFHwait:        djnz r5,wait        djnz r6,wait1        djnz r7,wait2        ret        end<br />ASSEMBLY CODE CONTD<br />
  16. 16. #include <reg51.h> //Define 8051 registers<br />#include<stdio.h><br />void DelayMs(unsigned int); //Delay function<br />void Clockwise (void)<br />{<br /> unsigned int i;<br /> for (i=0;i<30;i++)<br /> {<br /> P0 = 0x01;DelayMs(5); //Delay 20msec<br /> P0 = 0x02;DelayMs(5);<br /> P0 = 0x04;DelayMs(5);<br /> P0 = 0x08;DelayMs(5);<br /> } <br />}<br />STEPPER MOTOR C CODE<br />
  17. 17. void AntiClockwise (void)<br />{<br /> unsigned int i;<br /> for (i=0;i<30;i++)<br /> {<br /> P0 = 0x08;DelayMs(5); //Delay 20msec<br /> P0 = 0x04;DelayMs(5);<br /> P0 = 0x02;DelayMs(5);<br /> P0 = 0x01;DelayMs(5); <br /> }<br />}<br />void main (void)<br />{<br /> P0 = 0; //Initialize Port0<br />C CODE CONTD<br />
  18. 18. C CODE CONTD<br />while(1) //Loop Forever<br /> {<br /> Clockwise ();<br />DelayMs (100);<br /> P0 = 0;<br /> AntiClockwise ();<br /> DelayMs (100);<br /> P0 = 0;<br /> }<br />}<br />void DelayMs(unsigned int n)<br />{<br />
  19. 19. unsigned int i,j;<br /> for(j=0;j<n;j++)<br /> {<br /> for(i=0;i<800;i++);<br /> }<br />}<br />C CODE CONTD<br />
  20. 20. For more details<br />www.pantechsolutions.net<br />http://www.slideshare.net/pantechsolutions<br />http://www.scribd.com/pantechsolutions<br />http://www.youtube.com/pantechsolutions<br />

×