problem in driving the stepper motor in at89c51 in protius

Status
Not open for further replies.

pratti

Member level 3
Joined
Jun 15, 2013
Messages
56
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Visit site
Activity points
471
my steper motor doesnot rotate 180 in protius.in protius it just stopt at -2.42.why is it so?my code is as below



Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include<reg52.h>
 
#include<stdio.h>
 
void T0delay(int);
 
void main()
{
int count;
count=0;
  do
  {
  for(count=0;count<=48;count++)
  {
    P2=0x06; //0001
    T0delay(100);
    P2=0x03; //0100
    T0delay(100);
    P2=0x09; //0010
    T0delay(100);
    P2=0x0C; //1000
    T0delay(100);
    }
  }while(1);
}
 
//void T0delay(int k)
//{
 // int i,j;
 // for(i=0;i<1275;i++)
 //{
 // for(j=0;j<k;j++)
 // {
 // }
//}
//}
  void T0Delay()            //delay by  using timer
{
 
TMOD=0x01;                       // timer 0, mode 1
TL0=0x35;                        // load TL0
TH0=0x00;                      // load TH0
TR0=1;                               // turn on Timer0
while (TF0==0);           // wait for TF0 to roll over
TR0=0;                            // turn off timer
TF0=0;                           // clear TF0
}

 
Last edited by a moderator:

hi
I think error in your programming

i have modified your code check it...

Code:
#include<reg52.h>
#include<stdio.h>

void T0delay();

void main()
{
int count;
count=0;
do
{
for(count=0;count<=48;count++)
{
P2=0x06; //0001
T0delay();
P2=0x03; //0100
T0delay();
P2=0x09; //0010
T0delay();
P2=0x0C; //1000
T0delay();
}
}while(1);
}


void T0delay() //delay by using timer
{

TMOD=0x01; // timer 0, mode 1
TL0=0x35; // load TL0
TH0=0x00; // load TH0
TR0=1; // turn on Timer0
while (TF0==0); // wait for TF0 to roll over
TR0=0; // turn off timer
TF0=0; // clear TF0
}
 

still it stops at -0.31 in protius?is there any change that i have to make in stepper motor in protius?
 

code is correct bt it is only rotating 7.5 degree in protius .how to continue this rotation till 360 degree?
 

Is your schematic like this


Code:
#include<reg52.h>
#include<stdio.h>

void T0delay();

void main()
{
unsigned int count;
count=0;
do
{
for(count=0;count<=48;count++)
{
P2=0x06; //0001
T0delay();
T0delay();
T0delay();
P2=0x03; //0100
T0delay();
T0delay();
T0delay();
P2=0x09; //0010
T0delay();
T0delay();T0delay();
P2=0x0c; //1000
T0delay();			T0delay();T0delay();

}
}while(1);
}


void T0delay() //delay by using timer
{

TMOD=0x01; // timer 0, mode 1
TL0=0x35; // load TL0
TH0=0x00; // load TH0
TR0=1; // turn on Timer0
while (TF0==0); // wait for TF0 to roll over
TR0=0; // turn off timer
TF0=0; // clear TF0
}
 

my protius file cant be uploaded,problem occurs.i am using l293d and bipolar motor and the motor is not rotating.i want to keep 1 minute delay.how could i do that?should i call the time delay function many times?
 

ya i write.bt i think i signal is not passing to the motor from l293d
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…