Yahoo Groups archive

Lpc2000

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

Thread

help for read PWM

help for read PWM

2004-10-27 by dasbento@aeiou.pt

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\ufffd\ufffdo profissional - pe\ufffda informa\ufffd\ufffdes aqui.:
http://ceac.online.pt/

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:
Show quoted textHide quoted text
> 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/

Re: help for read PWM

2004-11-05 by g2100g

If you have spare i/o pins, you can tie the capture signal to another 
pin for reading.

--- In lpc2000@yahoogroups.com, "moostieuk" <moostieuk@y...> wrote:
> 
> 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
Show quoted textHide quoted text
> > 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/

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.