Need help to Control speed of the Motor using PWm for LPC2378

Status
Not open for further replies.

nagarajanj21

Member level 1
Joined
Aug 24, 2010
Messages
37
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,288
Location
Chennai, INDIA
Activity points
1,492
i need help ho to calculate the duty cycle of the PWm in LPC2378(explain it breifly) and i have use the IR sensor for motor to rotate motor i clock and anticlock direction... how to do this..



thanks in advance.... wish u a HAPPY NEW year
 

first u will have to tell me that u have single face motor or three,i can help u because i have worked to much with pwm technology in picmicrocontroler and i can make remote control also
 

i am using 12 DC motor with driver... i need how to stop and rotate clock wise and anti clock wise directions... sorry for late reply...


thanks in advance
 

#include <LPC23xx.H> /* include for LPC23xx */

static void PWMInit(){
/* considering LPC2387 */
/* Select PWM1.2 output on P1.20 */
PINSEL3 |= (0x2 << 8);

/* reset PWM counter */
PWM1TCR = 0x02;

/* setup match control to reset on MR0 */
PWM1MCR = 0x02;

/* select single edge for PWM1.2 and enable PWM1.2 o/p */
PWM1PCR = 1 << 10;

/* setup PWM period */
PWM1MR0 = 100;

/* setup PWM duty cycle (50%) */
PWM1MR2 = 50;

/* start counter and enable PWM */
PWM1TCR = 0x81;

/* enable LER */
PWM1LER = 0x04;
}

int main(){
PWMInit();
while(1);
}
 

i already did that above coding... but i what i want is to rotate motor reversly as well as control the speed of motor using IR sensor...............
 

Swap the On Off period

---------- Post added at 15:58 ---------- Previous post was at 15:58 ----------

which driver are you using for motor
 

i cant interface motor directy with the processor. thats why i use driver ckt. just for giving data to the motor...
 

If i put
PWM1MR0 =0x100 and PWM1MR2=50 its not working.... instead i Put

PWM1MR0 = 12000000/500; and PWM1MR2 = PWM1MR0/2 mans its working...
 

If i put
PWM1MR0 =0x100
PWM1MR2=50 ------------> its not working wave for PWm is not generated....

instead i Put

PWM1MR0 = 12000000/500;
PWM1MR2 = PWM1MR0/2 its working...


why u put PWM1MR0 = 100;
PWM1MR2 = 50;


explain me it detail.....
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…