We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
HI I AM WORKING ON STEPPER MOTOR WITH MICROCONTROLLOR(P89V51RD2BN).THIS IS MY PROGRAM. #include<reg52.h>
#define ST_CNTRL P1;
void delay(void);
void main() { unsigned char k; for(k=0;k<30;k++) { P1 = 0x66; delay(); P1 = 0xcc; delay(); P1 = 0x99; delay(); P1 = 0x33; delay(); } }
void delay(void) { unsigned int i,j;
for(i = 0; i<0x20; i++) { for(j = 0; j<0x20; j++) { } } } PROBLEM IS THE STEPPER MOTOR DOESNT STOP AFTER 30 STEPS AS GIVEN IN FOR LOOP.IT JUST JERKS AFTER 30 STEPS AND CONTINUE ROTATING,I WANT TO STOP IS AFTER 30 STEPS. CAN ANY ONE HELP?
Thank you very much for the response sir..but if u could write me the code,it'l be helpful sir, me new to electronics field.please do help
but if u could write me the code
You lost soul! You should have immediately asked that instead of giving us the false hope that you actually intend to learn something new.
well i tried my best,tried to use a break,abort and return statements to exit from loop neither of them worked..so pls do help me with the code.
"me new to electronics field"
Are you actually interested in learning how to do this yourself, or do you really just want someone to do it for you?
So long as it's not supposed to be your own work (eg, a school assignment), there's no harm in getting others to do stuff for you; after all, most people are not interested in maintaining & repairing their own cars - so they pay someone else to do it for them.
But there's the key - you will have to be prepared to pay!
There's a list of consultants who can do such stuff here: http://www.keil.com/condb No doubt you could also find local listings.
well yes ..i would like to do it myself..but i need a little more help..atleast help me as to why arent abort or break any of thes statements not helpin to come out of loop and wat kind of loopin me supposed to use?
Picking 'C' statements at random is not a good way to proceed.
You need to start by laying some basic foundations in embedded programming.
I suggest that you start here: http://www.keil.com/books
See also: www.8052.com/.../174564
Thank you everyone for the help and push..i managed to make my stepper motor stop as intended...HURRAY..this is my updated program: #include<reg52.h>
void main() { unsigned int k,j; for(k=0;k<87;k++) { P1 = 0x66; delay(); P1 = 0xcc; delay(); P1 = 0x99; delay(); P1 = 0x33; delay();
} for(j=0;j<0xff;j++) { for(k=1;k<0xff ;k++) { j=0; P1 =0x00; } } }
for(i = 0; i<0x20; i++) { for(j = 0; j<0x20; j++) { } } }
What was wrong with just a
while (1) ;
or
for (;;) ;
just before the closing brace of main()? Too simple versions of an infinite loop?
This is most definitely not the most beautiful infinite loop I have seen:
for (j = 0; j < 0xff; j++) { for (k = 1; k < 0xff; k++) { j = 0; P1 = 0x00; } }
But at least you didn't use goto to create the loop.
OH tat worked sir..Thank you very much for the help:)
hi did it work
Just checking if I can post to this thread.