avr-chat
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-chat] Reading Ports?


From: Daniel O'Connor
Subject: Re: [avr-chat] Reading Ports?
Date: Mon, 5 Jun 2006 13:33:31 +0930
User-agent: KMail/1.9.1

On Monday 05 June 2006 12:42, Chris Spencer wrote:
> However, my program doesn't cause the LED to blink, leaving me to
> believe it's having a problem reading the two status bits. I've manually
> confirmed that the hardware is setting the correct signals based on
> actuator state, but the AVR acts like the they're always low, even when
> I measure them high. The following is my short test program. It should
> make the actuator extend and contract indefinitely, lighting the LED
> while it's extending.
>         loop_until_bit_is_set(PORTB, PB4); // Wait until fully contracted.
...
>         loop_until_bit_is_set(PORTB, PB5); // Wait until fully extended.

You need to read from PINB - PORTB is a register which shows what you have set 
the port to (regardless of DDR).

I've fallen into this trap too, it's not uncommon :)

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

Attachment: pgpjGgOzNohd7.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]