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.

stepper motor control using 89c51 microcontroller

Status
Not open for further replies.

devarajan234

Newbie level 2
Joined
Feb 8, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
kalpakkam,tamilnadu
Activity points
1,301
hi

this is deva i want to write a program in keil c for stepper motor control using atmel 89c51 . my project involves controlling stepper motor(sanyo denki) which has 1.8 degree rotation per step through san motion driver . i want the stepper motor to rotate 22.8 degree and wait for 5sec delay and again rotate for same degree and wait for 5 sec similarly it has to complete totally 16 times 0r 16 counts and then it has to stop . for this 22.8 degree rotation i am generating 250 pulses. i want the above details to be written in keil c so please help in achieving above criteria through keil c.:p
 

start to write the code we will help you

---------- Post added at 14:47 ---------- Previous post was at 14:45 ----------

if you get any problem post it here
 

#include<AT89X52.h>
#include<stdio.h>
sbit led= p1^5;
void T0M1delay();
void main()
{
unsigned int j;
int c;
c++;
for(j=0;j<250;j++)
{
led=1;
T0M1delay();
}
if (c> 16)
{
led=0;}
}
void T0M1 delay()
{
TMOD&=0xF0;
TMOD|=0x10;
TH0=0XED;
TL0=0XFF;
IE=0;
TF=0;
if(TF==0)
TR=0;}

---------- Post added at 19:57 ---------- Previous post was at 19:43 ----------

in the above program i tested with a led and i was not able to generate 5 sec delay and after 16 counts it has to be stopped but i did not get same result so please help me with the coding.

---------- Post added at 20:05 ---------- Previous post was at 19:57 ----------

please help me with above coding.

---------- Post added at 20:13 ---------- Previous post was at 20:05 ----------

please help me with above coding.

---------- Post added at 20:16 ---------- Previous post was at 20:13 ----------

please help me with above coding.
 

what is the time output you are getting... adjust the delay to be approximate to your requirement...

you get accurate value of delay only in assembly program and not in C.. In C program you get nearest value....

So its more of trial and error method.... just run theled for required time and stop it for 5 sec and again start the led blink... keep on varying the value till you get approximate value
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top