On May 8, 2009, at 11:41 AM, Robert von Knobloch wrote:

Hallo,

I am writing code for an ATMega 644P and have come across some very
strange behaviour.
A small part of the code is required to read an asynchronous serial
signal (data & clock - low speed) over PORTB pins.
The relevant code snippet is:

snip
#define CLOCK_TIMEOUT    2000
#define ASYNCPIN    PORTB
#define ASYNCCLK    0
#define ASYNCDATA    3

    for (i = 0 ; i < 16 ; ++i)
    {
while ((ASYNCPIN & _BV(ASYNCCLK)) != 0) // Wait for clock low

(...)
Sorry for out of topic, but shouldn't you use PINB instead of PORTB when reading pin state?

Regards,
PN



_______________________________________________
AVR-chat mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-chat

Reply via email to