dolphinlabs
...
Doplhin labs
News

LPC2148-DC Motor interfacing



Warning: readfile(DC Motor.htm) [function.readfile]: failed to open stream: No such file or directory in /home/dolphinlabs/public_html/Word-SubMenu-Display.php on line 104

1.      DC Motor

Objective:

Write a program to rotate DC 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 12V pin of DC motor interface to +12V supply pin. And GND to GND pin of supply.

3.      Connect EN12 pin to +5V of microcontroller and IN1 and IN2 pins to P1.16 and P1.17 respectively.

4.      Connect OUT1 and OUT2 pins of DC motor interface to DC motor.

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=0x30000;     //Set direction of IN1, IN2

 

while(1)

{

IOSET1=0x10000;        //set IN1=1

IOCLR1=0x20000;       //Clear IN2=0

 delay(10000);

}

}

 

 


Get SOCIAL







SAFE & SECURE SHOPPING

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