Yahoo Groups archive

Lpc2000

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

Message

Re: help for read PWM

2004-10-27 by moostieuk

You can't do this!  Once the pin is set to one of the special
functions you cannot read it's state. (Bit of a mistake imho, but
theres probably a perfectly good explanation why this is the case)

What you need to do is:

Set the capture to rising edge.

When the interrupt trips, start a counter and switch the capture type
to falling edge.

When the interrupt trips save your counter, that gives you your "mark"
period.  Set the capture type back to rising edge and reset your counter.

When the interrupt trips again, save your counter that's your "space"
period.

Repeat!

Adrian

--- In lpc2000@yahoogroups.com, dasbento@a... wrote:
> Hello,
> 
> someone know how read pwm (i.e. detect if the value read (in CR0, CR1
> and CR2) is rising edge or falling edge), since I have interrupts
> enable in both transitions. My idea is the IOPIN register read only
> the current state when the pins are defined as I/O but this pins are
> defined as capture.
> 
> Someone already make any thing similar???
> 
> Thanks!!!
>           Domingos
> 
> _________________________________________________________
> CEAC Cursos de formação profissional - peça informações aqui.:
> http://ceac.online.pt/

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.