stepper motor controll with AT89C51
Hey....
I want to controll Stepper motor with At89c51..
and i made simulation in proteus.. and program made in keil
.
.
.
but i cant make loop for it.... it will rotate only one rotation
so, can Anybudy help me for making loop...???😔.. for full rotation....
this is the fig.
and this is code for it...
#include
void delay(unsigned int);
void main (void)
{
P2_4=0;
delay(30000000000);
P2_4=1;
delay(30000000000);
P2_2=0;
delay(30000000000);
P2_2=1;
delay(30000000000);
P2_3=0;
delay(30000000000);
P2_3=1;
delay(30000000000);
P2_1=0;
delay(30000000000);
P2_1=1;
delay(30000000000);
}
void delay(unsigned int itime)
{
int i;
for(i=0;i
}
I want to controll Stepper motor with At89c51..
and i made simulation in proteus.. and program made in keil
.
.
.
but i cant make loop for it.... it will rotate only one rotation
so, can Anybudy help me for making loop...???😔.. for full rotation....
this is the fig.
and this is code for it...
#include
void delay(unsigned int);
void main (void)
{
P2_4=0;
delay(30000000000);
P2_4=1;
delay(30000000000);
P2_2=0;
delay(30000000000);
P2_2=1;
delay(30000000000);
P2_3=0;
delay(30000000000);
P2_3=1;
delay(30000000000);
P2_1=0;
delay(30000000000);
P2_1=1;
delay(30000000000);
}
void delay(unsigned int itime)
{
int i;
for(i=0;i
Replies
-
Harshad ItaliyaTry this code . . You forgot to add the infinite loop in this code.
#include
void delay(unsigned int); void main (void) { for(;;) { P2_4=0; delay(30000000000); P2_4=1; delay(30000000000); P2_2=0; delay(30000000000); P2_2=1; delay(30000000000); P2_3=0; delay(30000000000); P2_3=1; delay(30000000000); P2_1=0; delay(30000000000); P2_1=1; delay(30000000000); } } void delay(unsigned int itime) { int i; for(i=0;i -
Prakash Parmarthanx a lot sir.....
.
.
can you tell me how can i set "ON" or "OFF" logic for port 0.0..
so, if i gave logic to port 0.0 "1" then it start... & logic to port 0.0 "0" then it stop... for below image.....
.
.
thank you.... -
Harshad Italiyacan you change your pin from p0.0 to p3.2 it is interrupt pin?
-
Prakash Parmarinstead of p3.2(intrupt pin) it will be possible with pin p3.4, p3.5, p3.6, p3.7...????
.
.
bcause my project diagram is look like below....
so, how can i controll stepper motor...???.. if you have any simple program then also tell me.... because i am new to microcontroller or say "0" in microcontroller....
.
.
and my main referance is..
#-Link-Snipped-# -
Harshad Italiyawell it's possible but as you see there is delay in between port pin change. Ok how if i guide you that how to write code instead of giving you code directly. First you try then i'll point out your fault. Is it fine?
-
Harshad Italiya#-Link-Snipped-# , Are you working on code or not?
-
Harshad ItaliyaWith reference of this design. . . .
You are going to tranfer data on Port pin P3.4/P3.5/P3.6/P3.7 to Stepper motor Right? and P3.3 Decides to Turn Motor ON and OFF. -
Prakash Parmaryes.... the port pin connection is right....
.
.
but i cant understand its logic ...
because our project title is "RF BASED WIRELESS STEPPER MOTOR USING PARALLEL PORT"
so we made vb form. In that form there are "ON" , "OFF", "clockwise" and "anticlockwise" button... and so there are 4 logic and 4 dataout pin of HT12D, so by that datout pin we have to contorll the motor...
and the above code work for loop which is uncontrollabe... so I have to control it...
.
.
.
I found a Program in Mazidi(book) which rotate the motor clockwise and anticlockwise with the help of switch(but it not works)...
#include
sbit SW=P2^7; void main() { SW=1; while(1) { if(SW==0) { P1=0x66; MSDelay(100); P1=0xCC; MSDelay(100); P1=0x99; MSDelay(100); P1=0x33; MSDelay(100); } else { P1=0x66; MSDelay(100); P1=0x33; MSDelay(100); P1=0x99; MSDelay(100); P1=0xCC; MSDelay(100); } } } void MSDelay(unsigned int value) { unsigned int x,y; for(x=0;x<1275;x++) for(y=0;y .
.
.
.
my english is so poor......😔 , so can we communicate in HINDI or GUjarati???? -
Prakash Parmar
ok... guide me ... there are any other comand for delay or port change???godfatherwell it's possible but as you see there is delay in between port pin change. Ok how if i guide you that how to write code instead of giving you code directly. First you try then i'll point out your fault. Is it fine? -
Harshad Italiya
CE is Global forum and we follow English only. Well Now let me know The code you have Posted in first post and I have corrected it in second post. Have you tested that code on Hardware?Prakash Parmaryes.... the port pin connection is right....
.
.
but i cant understand its logic ...
because our project title is "RF BASED WIRELESS STEPPER MOTOR USING PARALLEL PORT"
so we made vb form. In that form there are "ON" , "OFF", "clockwise" and "anticlockwise" button... and so there are 4 logic and 4 dataout pin of HT12D, so by that datout pin we have to contorll the motor...
and the above code work for loop which is uncontrollabe... so I have to control it...
.
.
.
I found a Program in Mazidi(book) which rotate the motor clockwise and anticlockwise with the help of switch(but it not works)...
#include
sbit SW=P2^7; void main() { SW=1; while(1) { if(SW==0) { P1=0x66; MSDelay(100); P1=0xCC; MSDelay(100); P1=0x99; MSDelay(100); P1=0x33; MSDelay(100); } else { P1=0x66; MSDelay(100); P1=0x33; MSDelay(100); P1=0x99; MSDelay(100); P1=0xCC; MSDelay(100); } } } void MSDelay(unsigned int value) { unsigned int x,y; for(x=0;x<1275;x++) for(y=0;y .
.
.
.
my english is so poor......😔 , so can we communicate in HINDI or GUjarati????
We will go step by step. So, First complete this step and let me know. -
Prakash ParmarI dont have tested on hardware but tested this code in proteus... and it wors... but first step it rotate in anticlockwise then constatnly rotate in clockwise.... and the stepangle is "90". but when i changed it to "1.8"{because i have 1.8 degree stepper motor} the 360 rotation takes more time..
.
.
my simulation and program is here #-Link-Snipped-#
. -
Harshad Italiya
Right now we are using Full Stepping you have to use Half stepping and give it a try.Prakash ParmarI dont have tested on hardware but tested this code in proteus... and it wors... but first step it rotate in anticlockwise then constatnly rotate in clockwise.... and the stepangle is "90". but when i changed it to "1.8"{because i have 1.8 degree stepper motor} the 360 rotation takes more time..
.
.
my simulation and program is here #-Link-Snipped-#
.
You are reading an archived discussion.
Related Posts
I am searching for books on agricultural entrepreneurs and agriculture in general. I want them in Indian context. Those I found were American and I guess not much work is...
Just a few minutes ago, I wrote a brief email to an influential personality who's trying to drive development in central India. I was asked for my ideas and while...
Why is it necessary to use iron core in the LVDT (Linear Varibale Different Transformer)?
Hi,
My name is Franck. I am trying to use the RFM70 -D via PIC18F4610 but my knowledge in this area is a bit weak. Basically I do not completely...
I hope this isn't the wrong place to post this kind of question.
I'm building a home made "long tail" outboard motor. I'm trying to take a 9HP Hatz diesel...