EmbeddedRelated.com
Forums
Memfault Beyond the Launch

how to interface servo motors with lpc2129

Started by aki_...@yahoo.com February 6, 2011
hi...can i get some tutorials on interfacing servo motors with lpc2129 using "PWM"... as i m new to tihs field... can i get some sample code to set the PWM for lpc2129 in C.i m using keil uvison3.

An Engineer's Guide to the LPC2100 Series

--- In l..., aki_kaif@... wrote:
>
> hi...can i get some tutorials on interfacing servo motors with lpc2129 using "PWM"... as i m new to tihs field... can i get some sample code to set the PWM for lpc2129 in C.i m using keil uvison3.
>

Google is your friend.

You need to set the PWM for a total period of 20 mS (50 Hz) then set the pulse width to vary between 1.0 mS and 2.0 mS. For most servos, 1.5 mS will be mid-position.

You can find PWM code here:
www.jcwren.com/arm

Use pwmPulseWidthInMicroseconds with arguments between 1000 and 2000.

The code is for the LPC2148. Again, check the pin functionality of the LPC2148 versus the LPC2129. You may have to wander through the code to find out what JC used for the system clock frequency. Or, just look at the PWM settings and work backwards.

JC makes the comment that the servo signal should be buffered:
http://www.jcwren.com/arm/#pwm

That may not be necessary. Ignore the comments re: % on time and just just the function I stated above.

Richard


Memfault Beyond the Launch