Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/freehos1/public_html/projectus/core/open_close_dbase_connection.php on line 0

Deprecated: Function split() is deprecated in /home/freehos1/public_html/projectus/Stepper-motor-control/index.php(0) : eval()'d code on line 22

Deprecated: Function split() is deprecated in /home/freehos1/public_html/projectus/Stepper-motor-control/index.php(0) : eval()'d code on line 35

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/freehos1/public_html/projectus/scripts/get_ad_type_position.php on line 0

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/freehos1/public_html/projectus/scripts/load_ads.php on line 0

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/freehos1/public_html/projectus/scripts/sponsor_found.php on line 0

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/freehos1/public_html/projectus/scripts/load_links.php on line 0

Deprecated: Function split() is deprecated in /home/freehos1/public_html/projectus/Stepper-motor-control/index.php(0) : eval()'d code on line 161

Deprecated: Function split() is deprecated in /home/freehos1/public_html/projectus/Stepper-motor-control/index.php(0) : eval()'d code on line 164

Deprecated: Function split() is deprecated in /home/freehos1/public_html/projectus/Stepper-motor-control/index.php(0) : eval()'d code on line 167
c program for stepper motor control
projectus.freehost7.com:UG and PG level projects,mini projects and many more here ...



C Program for Stepper Motor Control

Program for low torque rotation:

#include<reg51.h>

#include<stdio.h>

sbit sw=P2^7;

unsigned int delay(unsigned int count)

{

unsigned int i;

for(i=0;i<count;i++);

}

void main()

{

sw=1;

while(1)

{

if(sw==0)

{

P1=0x01;

delay(100);

P1=0x02;

delay(100);

P1=0x04;

delay(100);

P1=0x08;

delay(100);

}

else

{

P1=0x01;

delay(100);

P1=0x08;

delay(100);

P1=0x04;

delay(100);

P1=0x02;

delay(100);

}

}

}

 

Program for High Torque rotation:

#include<reg51.h>

#include<stdio.h>

sbit sw=P2^7;

unsigned int delay(unsigned int count)

{

unsigned int i;

for(i=0;i<count;i++);

}

void main()

{

sw=1;

while(1)

{

if(sw==0)

{

P1=0x03;

delay(100);

P1=0x06;

delay(100);

P1=0x0C;

delay(100);

P1=0x09;

delay(100);

}

else

{

P1=0x03;

delay(100);

P1=0x09;

delay(100);

P1=0x0C;

delay(100);

P1=0x06;

delay(100);

}

}

}

 

Program description

In our program we are rotating the stepper motor in clockwise and anticlockwise direction. We are using port A as output port. We have programmed the first four pins of port A to generate the desired pulse sequence for the rotation of the stepper motor. After one output at port A a Delay subroutine is called which provides a delay according to the given value in the main program. After this delay next pulse sequence is sent to the output that is port A.

Pin P-2.7 or pin number 28 of the microcontroller is used as the status pin the program reads the status of this pin, if it is low or 0 the motor rotates clockwise if the status is high then the motor rotates anticlockwise. To stop the rotation reset button is pressed.

For rotating the stepper motor in high torque mode similar thing is repeated but only changing the pulse pattern.

The speed of the motor is controlled by adjusting the delay count in the delay program. If the delay count is large the pulses comes slow at the output Pin, if the delay count is small then the pulses comes fast at the output and accordingly the speed of the motor is varied.

Applications of of stepper motor control

 

Robotics

Motion Control and Industrial Equipment

Techno-Art

In Camera lenses adjustment

In printer

Hard disks

CD player