Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: PWM demodulation

2005-04-26 by Peter Gray

Thanks Bob. Capturing both edges on a single timer works like a 
charm (I use a global var as a counter, and use it to populate a 
small global array from within the interrupt). By capturing three 
values, I can do some simple math to figure out which edge is which, 
and hence grab the pulse width.

-Pete.
--- In lpc2000@yahoogroups.com, "lpc2100_fan" <lpc2100_fan@y...> 
wrote:
> 
> Peter,
> 
> use one Timer and capture on both edges.  Depending on your system
> setup this limits the minimum pulse width somewhat but assuming it 
is
> more than 1 usec it should be doeable.  You have to make sure that 
you
> did already read the first value before the second got captured.
> Another option is to use two capture inputs (not two timers) and 
do it
> like you proposed the difference of the two timer snapshots.
> 
> hth Bob
> 
> 
> --- In lpc2000@yahoogroups.com, "Peter Gray" <peter_f_gray@y...> 
wrote:
> > 
> > On other microcontrollers I've used, it was possible to start a 
single 
> > timer on a rising edge, and capture-and-reset on a falling edge 
(to 
> > capture the pulse time).
> > 
> > It doesn't look like this method is available on the (for 
example) 
> > LPC2131. What would be a good mechanism for these 
microcontrollers? 
> > Start two timers, feed the PWM to two pins, have one capture-and-
reset 
> > on rising edge, the other on the falling edge? (the difference 
between 
> > the two capture registers would be the pulse time) or is there a 
> > better way?
> > 
> > Thanks,
> > -Pete.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.