Yahoo Groups archive

Lpc2000

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

Thread

Reading capture pins

Reading capture pins

2004-04-04 by bobbruce000

I have several pins configured as capture pins which interrupt on
either a rising of falling edge.  Then in the interrupt handler
I read the IOPIN register to get the value.

According the description of the IOPIN register on page 81 of the
Philips 210x User Manual, this should work.  I quote:

  "The current state of the port pins can always be read from
    this register, regardless of pin direction and mode."

But it doesn't seem to work.  I have double and triple checked
my code, and I 95% sure this is not a software bug.  The capture
pins always read zero.

Is the user manual wrong?

    -bob

Re: Reading capture pins

2004-04-04 by moostieuk

I've tried this before, it appears that once you've put the pins
capture/compare mode you cannot read the state directly from the pin.  

I was reading a PWM signal, so in the end I just ended up creating a
state machine and in the capture interrupt change the edge triggering
for the next capture.

Adrian

--- In lpc2000@yahoogroups.com, "bobbruce000" <bobbruce000@y...> wrote:
Show quoted textHide quoted text
> I have several pins configured as capture pins which interrupt on
> either a rising of falling edge.  Then in the interrupt handler
> I read the IOPIN register to get the value.
> 
> According the description of the IOPIN register on page 81 of the
> Philips 210x User Manual, this should work.  I quote:
> 
>   "The current state of the port pins can always be read from
>     this register, regardless of pin direction and mode."
> 
> But it doesn't seem to work.  I have double and triple checked
> my code, and I 95% sure this is not a software bug.  The capture
> pins always read zero.
> 
> Is the user manual wrong?
> 
>     -bob

Re: Reading capture pins

2004-04-04 by bobbruce000

--- In lpc2000@yahoogroups.com, "moostieuk" <moostieuk@y...> wrote:
> I've tried this before, it appears that once you've put the pins
> capture/compare mode you cannot read the state directly from the
> pin.  
> 
> I was reading a PWM signal, so in the end I just ended up creating
> a state machine and in the capture interrupt change the edge
> triggering for the next capture.

A state machine won't work for my application.  I suppose I can
use the capture pins to trigger the interrupt, and read the state
from another set of pins that mirror the values.  But what a waste
of pins!  I suppose I could move to a 2114 to get some extra pins,
but then I need to squeeze the RAM requirements down to only 16k.
I hate tradeoffs.

The Philips User Manual is clearly wrong about this.  I read the
docs carefully, believed what they said, and now I have to toss a
couple of prototype boards in the trash and rewrite the software
when I am already behind schedule.  They should fix their dang
docs and not leave this for the next engineer to trip over.  This
isn't a printed manual, it is just a PDF file, so it shouldn't be
much effort to fix. 

    -bob
Show quoted textHide quoted text
> --- In lpc2000@yahoogroups.com, "bobbruce000" <bobbruce000@y...> wrote:
> > I have several pins configured as capture pins which interrupt on
> > either a rising of falling edge.  Then in the interrupt handler
> > I read the IOPIN register to get the value.
> > 
> > According the description of the IOPIN register on page 81 of the
> > Philips 210x User Manual, this should work.  I quote:
> > 
> >   "The current state of the port pins can always be read from
> >     this register, regardless of pin direction and mode."
> > 
> > But it doesn't seem to work.  I have double and triple checked
> > my code, and I 95% sure this is not a software bug.  The capture
> > pins always read zero.
> > 
> > Is the user manual wrong?
> > 
> >     -bob

Re: Reading capture pins

2004-04-04 by haack0815

Hi Bob,

I asked the Philips support the following questions in mid march:

When will be new Errata sheets for the LPC 2106 and 2124 are available ?
When will be newer User manuals of the LPC 2124 are available ?

and I get the following answer for Richard at Philps Support:

"The errata is "in the works", there is severe latency between
production and web posting.
You are correct, the users manual is on the way. "

But I don't know how long are the way and I'm still waiting until today. 

Andreas


--- In lpc2000@yahoogroups.com, "bobbruce000" <bobbruce000@y...> wrote:
> --- In lpc2000@yahoogroups.com, "moostieuk" <moostieuk@y...> wrote:
> > I've tried this before, it appears that once you've put the pins
> > capture/compare mode you cannot read the state directly from the
> > pin.  
> > 
> > I was reading a PWM signal, so in the end I just ended up creating
> > a state machine and in the capture interrupt change the edge
> > triggering for the next capture.
> 
> A state machine won't work for my application.  I suppose I can
> use the capture pins to trigger the interrupt, and read the state
> from another set of pins that mirror the values.  But what a waste
> of pins!  I suppose I could move to a 2114 to get some extra pins,
> but then I need to squeeze the RAM requirements down to only 16k.
> I hate tradeoffs.
> 
> The Philips User Manual is clearly wrong about this.  I read the
> docs carefully, believed what they said, and now I have to toss a
> couple of prototype boards in the trash and rewrite the software
> when I am already behind schedule.  They should fix their dang
> docs and not leave this for the next engineer to trip over.  This
> isn't a printed manual, it is just a PDF file, so it shouldn't be
> much effort to fix. 
> 
>     -bob
> 
> 
> > --- In lpc2000@yahoogroups.com, "bobbruce000" <bobbruce000@y...>
wrote:
Show quoted textHide quoted text
> > > I have several pins configured as capture pins which interrupt on
> > > either a rising of falling edge.  Then in the interrupt handler
> > > I read the IOPIN register to get the value.
> > > 
> > > According the description of the IOPIN register on page 81 of the
> > > Philips 210x User Manual, this should work.  I quote:
> > > 
> > >   "The current state of the port pins can always be read from
> > >     this register, regardless of pin direction and mode."
> > > 
> > > But it doesn't seem to work.  I have double and triple checked
> > > my code, and I 95% sure this is not a software bug.  The capture
> > > pins always read zero.
> > > 
> > > Is the user manual wrong?
> > > 
> > >     -bob

Re: [lpc2000] Re: Reading capture pins

2004-04-04 by Bill Knight

Just a though, but what about, in the interrupt routine, switch the
pin(s) to GPIO input, read the pin state, then switch the pin(s)
back to the original function?

Regards
-Bill Knight
R O SoftWare
Show quoted textHide quoted text
On Sun, 04 Apr 2004 16:00:23 -0000, bobbruce000 wrote:

>--- In lpc2000@yahoogroups.com, "moostieuk" <moostieuk@y...> wrote:
>> I've tried this before, it appears that once you've put the pins
>> capture/compare mode you cannot read the state directly from the
>> pin.  
>> 
>> I was reading a PWM signal, so in the end I just ended up creating
>> a state machine and in the capture interrupt change the edge
>> triggering for the next capture.

>A state machine won't work for my application.  I suppose I can
>use the capture pins to trigger the interrupt, and read the state
>from another set of pins that mirror the values.  But what a waste
>of pins!  I suppose I could move to a 2114 to get some extra pins,
>but then I need to squeeze the RAM requirements down to only 16k.
>I hate tradeoffs.

>The Philips User Manual is clearly wrong about this.  I read the
>docs carefully, believed what they said, and now I have to toss a
>couple of prototype boards in the trash and rewrite the software
>when I am already behind schedule.  They should fix their dang
>docs and not leave this for the next engineer to trip over.  This
>isn't a printed manual, it is just a PDF file, so it shouldn't be
>much effort to fix. 

>    -bob


>> --- In lpc2000@yahoogroups.com, "bobbruce000" <bobbruce000@y...> wrote:
>> > I have several pins configured as capture pins which interrupt on
>> > either a rising of falling edge.  Then in the interrupt handler
>> > I read the IOPIN register to get the value.
>> > 
>> > According the description of the IOPIN register on page 81 of the
>> > Philips 210x User Manual, this should work.  I quote:
>> > 
>> >   "The current state of the port pins can always be read from
>> >     this register, regardless of pin direction and mode."
>> > 
>> > But it doesn't seem to work.  I have double and triple checked
>> > my code, and I 95% sure this is not a software bug.  The capture
>> > pins always read zero.
>> > 
>> > Is the user manual wrong?
>> > 
>> >     -bob



> 
>Yahoo! Groups Links



>

Re: Reading capture pins

2004-04-05 by bobbruce000

--- In lpc2000@yahoogroups.com, "Bill Knight" <billk7670@c...> wrote:
> Just a though, but what about, in the interrupt routine, switch the
> pin(s) to GPIO input, read the pin state, then switch the pin(s)
> back to the original function?

This will not work reliably.  The value on the pin can change
just after you read the GPIO, but before you re-enable the
capture function.  So you can miss a transition.

    -bob

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.