Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Any 8051 program for control the speed of the stepper motor?

Status
Not open for further replies.
Hi,
I suggest you to use timer0, control the stepper's speed by the reload value.
 

Sir,
i am very confused controole the speed plz help me
 

Dont reopen old thread start new one!!!
 

Hi umairfuuast,

first of all please specify for which, do you want to controlle the speed.
If you want to controlle the speed of stepper moter,
which kind of micro and driver you used?

rivet back for futher help.

Ghanshyam
 

sir ,
how to read timer on flying mod i am using to update the value after 10ms
 

Hey u want any program that controls the speed of steeper motor its here

Servo Motor Control Using MATLAB - MATLAB ACADEMY

have a look on the above link..

Here is the CODE
Code:
#include <REGX51.H>
#include<string.h>
sbit SW = P1^7;
void SerTx(unsigned char);
void SerTx_Str(unsigned char[]);
void Delay(unsigned int itime);
void serial_int();
unsigned int delay;
unsigned char mybyte;
void main()
{

delay = 100;
SW = 1; //Making this as Input Pin
TMOD = 0x20;    //Timer-1, 8-Bit Auto Reload Mode
        TH1 = 0xFD;        //9600 Baud Rate When Crystal Used is 11.0592MHZ
        SCON = 0x50;
RI = 0;
TI = 0;
TR1 = 1;        //Start Timer
while(1)
{

if(SW == 0)
{ SerTx_Str("Anti-Clockwise Moving");
SerTx(13);
while(RI == 0)
{
P2 = 0x66;
Delay(delay);
P2 = 0xCC;
Delay(delay);
P2 = 0x99;
Delay(delay);
P2 = 0x33;
Delay(delay);
}
mybyte = SBUF;
SerTx(mybyte);
RI = 0;
SerTx(13);
switch(mybyte)
{
case '1': delay = 100;
break;
case '2': delay = 10;
break;
case '3': delay = 1;
break;
default: delay =10 ;
break;
}
RI = 0;
}
else if(SW == 1)
{
SerTx_Str("Clockwise Moving");
SerTx(13);
while(RI == 0)
{
P2 = 0x66;
Delay(delay);
P2 = 0x33;
Delay(delay);
P2 = 0x99;
Delay(delay);
P2 = 0xCC;
Delay(delay);
}
mybyte = SBUF;
SerTx(mybyte);
RI = 0;
SerTx(13);
switch(mybyte)
{
case '1': delay = 100;
break;
case '2': delay = 10;
break;
case '3': delay = 1;
break;
default: delay =10 ;
break;
}
}
}
}
void Delay(unsigned int itime)
{
unsigned int j,i;
for(i=0;i<1275;i++)
for(j=0;j<itime;j++);
}
void SerTx(unsigned char x)
{
    SBUF = x;
    while(TI==0);
    TI = 0;
}
void SerTx_Str(unsigned char str[])
{
unsigned int len,i;
len = strlen(str);
for(i=0;i<len;i++)
{
SerTx(str[i]);
}   
}


This code is written in keil compiler..

---------- Post added at 22:10 ---------- Previous post was at 22:08 ----------

You can also see this video
Which Shows how it works
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top