Yahoo Groups archive

Lpc2000

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

Message

Re: [lpc2000] 2106 and 2138 interrupt and IOPIN

2006-02-05 by Tom Walsh

charlesgrenz wrote:

>Hello group,
>
>  Have a strange problem. The following code works perfectly on a LPC2106.
>
>    if (((T1IR & T1IR_MR2INT) != 0) || (T1MR2 < T1TC)) // Timer 1,
>Match 2 - 500ms LED Delay <<<<<<<<<<<<<<<<<<<<<<
>       {
>        T1MR2 = T1TC + DEFAULT_TMR1_MR2_TIMEBASE; // Count up to this
>value. Generate 2 Hz interrupt.
>                    if ((IOPIN & POWER_LED) == 0)
>                       {
>                        IOSET = POWER_LED;
>                       }
>                    else
>                       {
>                        IOCLR = POWER_LED;
>                       }
>       }
>
>  
>
FWIW, as a matter of programming style, I always have the pin reflect a 
variable state.  I don't have any reason, other than the pin port 
structures of some processors read the value of the pin Latch as opposed 
to the actual value at the pin.  IIRC, 8051 was like this.

Having said that, never assume.  Are you measuring the actual voltage at 
that pin?  Are you assuming that since the LED is on / off that the pin 
voltage would be considered a 0 or 1 state?

OH!  and another thing, there may be something where the pin is 
programmed to an output state and there is no way to read the actual 
value of the pin / pin latch (always returns a 0 or 1).

Like I said, what you are doing is a bit unusual as far as common 
practice is concerned.


TomW

-- 
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------------------------------------------

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.