avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] Mega644 bit test problem


From: Piotr Nikiel
Subject: Re: [avr-chat] Mega644 bit test problem
Date: Fri, 8 May 2009 11:56:27 +0200


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





reply via email to

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