[SOLVED] 8051 interfacing with stepper motor using uln2003

Status
Not open for further replies.
how can i give program for that can u please tell me in c language....

- - - Updated - - -

#include<reg51.h>
#include<stdio.h>
//sfr P2=0xa0;
void delay()
{
unsigned int i,j,k;
for(i=0;i<5;i++)
for(j=0;j<25;j++)
for(k=0;k<50;k++);
}
main()
{
while(1)
{
P0=0x03;
delay();
P0=0x01;
delay();
P0=0x00;
delay();
P0=0x02;
delay();


}
}
 

Code:
// I am assuming P2.1 & P2.2 are connected with switches to provide input

sbit a = P2^1;      
sbit b = P2^2;


main()
{
while(1)
{
     if((a==0)&&(b==0))
     {
          for(;((a==0)&&(b==0));)
          {
                //give output 1
          }
     }

     if((a==1)&&(b==0))
     {
          for(;((a==1)&&(b==0));)
          {
                //give output 2
          }
     }

     if((a==0)&&(b==1))
     {
          for(;((a==0)&&(b==1));)
          {
                //give output 3
          }
     }

     if((a==1)&&(b==1))
     {
          for(;((a==1)&&(b==1));)
          {
                //give output 4
          }
     }

}
}
 

Actually he has 2 o/p from mcu which goes to pin 1 and 3 of uln2003. He has posted a diagram. There are 2 transistors which gets the same 2 o/ps of mcu and inverts it and gives it to input pin 2 and 4 of uln2003.

according to his circuit it is not possible to generate the reguired o/p because if

o/p 0f mcu is

00 his uln2003 i/p and o/p will be 1010, but the sequence required is any of the three kinds of drive shown here http://www.robosense.in/index.php/...r-motor-using-atmel-avr-microcontroller.html

if his mcu o/p is

00 then his uln2003 i/p and o/p is 1010
01 then ----------------------- 1001
10 then ----------------------- 0110
11 ---------------------------- 0101

what is his o/p of P2.0 and P2.1 that goes to pin 1 and 3 og uln2003
P2.0 and P2.1 gets inverted and goes to pin 2 and 4 of uln2003.
 

hi everyone finally i gottttttttttttttt it i am so happy....................
 

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…