[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-chat] Really dumb question about port IO
From: |
Matt.VanDeWerken |
Subject: |
[avr-chat] Really dumb question about port IO |
Date: |
Mon, 8 May 2006 12:44:53 +1000 |
Hi all:
Port IO has been covered a million times on this list, but I am having a
really basic prolem with it.
I am trying to read the value of a port pin on a mega128, using the
following syntax:
while( (PORT_PWRGOOD & (_BV(PIN_PWRGOOD))) == 0) {
if(++i>PWR_TIMEOUT) {return digpower = PWR_OFF;}
}
return digpower = PWR_ON;
But the function always returns PWR_OFF, even though the pin in question
has been raised. I have checked and double-checked the #define
PIN_PWRGOOD and PORT_PWRGOOD values (they are PORTB and PINB6
respectively, if it matters). I don't believe I've set the SFR to
enable the alternative function of the pin, either, and the timeout
value is huge (something like a couple of seconds, well after the pin
has gone high).
I must have missed something really basic, surely?
Cheers,
Matthew van de Werken - Electronics Engineer
CSIRO E&M - Rock Mass Characterisation - 1 Technology Court - Pullenvale
- 4069
p: (07) 3327 4142 * f: (07) 3327 4455 * e: address@hidden
"We do not inherit the earth from our ancestors, we borrow it from our
children."
-- Native American Proverb
- [avr-chat] Really dumb question about port IO,
Matt.VanDeWerken <=