[Fwd: Re: Mega644 bit test problem]

View: New views
1 Messages — Rating Filter:   Alert me  

[Fwd: Re: Mega644 bit test problem]

by Robert von Knobloch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Piotr Nikiel wrote:

> 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
> AVR-chat@...
> http://lists.nongnu.org/mailman/listinfo/avr-chat
>
>
>  
Yes, a typo in my mail.
It is really PINB (referenced through another #define which I omitted
for clarity, thus obscuring all sense)
Thanks,

Robert




_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat