To develop skills to interface stepper motor to 89c51 and rotate in clockwise and anticlockwise direction. Visit Website

To develop skills to interface stepper motor to 89c51 and rotate in clockwise and anticlockwise direction.

 

Exp 15: Aim: To develop skills to interface stepper motor to 89c51 and rotate in clockwise and anticlockwise direction.

Flowchart: 



Algorithm: 

  1. Initialize port P2 as output.
  2. Send hex value 0x33 to port 2 and add delay
  3. Send hex value 0x66 to port 2 and add delay.
  4. Send hex value 0xCC to port 2 and add delay.
  5. Send hex value 0x99 to port 2 and add delay.
  6. Repeat from step2.

Diagram:

 


OR


 

 

Program:

Step 3: ‘C’ Language Program

 

#include<reg51.h>

 

 

void delay_ms(unsigned int);

 

void main (void)

 {

P2=0x00;

 

while(1)

 {

  P2=0x33;

  delay_ms(100);

  P2=0x66;

  delay_ms(100);

 P2=0xCC;

 delay_ms(100);

 P2=0x99;

 delay_ms(100);

 }

}

 

void delay_ms(unsigned int k)

{

 unsigned int i,j;

  for(i=0;i<k;i++)

  {

    for(j=0;j<1275;j++);

  }

}

 

Comments

 

/* Special function register declarations */

/* For the intended 8051 derivative */

 

//Function prototype declaration

 

 

 

//Make port as output

 

//Infinite loop

 

 

 

 

 

 

 

 

 

 

 

 

//Delay function

 

Conclusion:

In this experiment, we learnt to develop interface of stepper motor in clockwise and anticlockwise direction.





Post a Comment

Visit Website
Visit Website