dolphinlabs
...
Doplhin labs
News

LPC2148-Stepper Motor Interfacing


1.      Stepper  Motor

Objective:

Write a program to rotate a motor.

Hardware Connections for LPC2148 Board:-

1.      Plug in the USB cable to your computer and to the Board. Once the USB cable is plugged in, Board is powered up.

2.      Connect +12 pin of stepper motor interface to +12V supply and GND  pin of stepper motor interface to GND pin of supply.

3.      Connect IN1 IN2 IN3 IN4 pins of stepper motor interface block to P1.16, P1.17, P1.18, P1.19 respectively.

4.      Connect OUT1 OUT2 OUT3 OUT4 pins of stepper motor interface block to stepper motor pins.

Diagram:

Source code:

#include<lpc21xx.h>

void delay(int count)

{

  int j=0,i=0;

 

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

  {

    /* At 60Mhz, the below loop introduces

    delay of 10 us */

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

  }

}

 

void main()

{

IODIR1=0xF0000;  //set direction from P1.16 to P1.19

while(1)

{

 

IOSET1=0x80000;  //Set P1.19   

delay(5000);

IOCLR1=0x80000;

 

IOSET1=0x40000;  //Set P1.18

delay(5000);

IOCLR1=0x40000;

 

IOSET1=0x20000;  //Set P1.17

delay(5000);

IOCLR1=0x20000;

 

IOSET1=0x10000;   //Set P1.16

delay(5000);

IOCLR1=0x10000;

}

}

 

 

 

 

 

 

 

 

 

 

 


Get SOCIAL







SAFE & SECURE SHOPPING

visa card master card maestro card
Maverick IT Industries Pvt. Ltd.