avr-chat
[Top][All Lists]
Advanced

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

RE: [avr-chat] Atmega128, JTAG and ADC


From: Larry Barello
Subject: RE: [avr-chat] Atmega128, JTAG and ADC
Date: Sun, 17 Jul 2005 16:39:58 -0700

Yes, indeed.  The original code is correct, my ad-lib typing in was a "doh"
moment.

It should have read:

if (!(MCUCSR & _BV(JTRF))) ...

BTW Testing for zero/non-zero takes less code than comparing to an explicit
bit value...

-----Original Message-----
From: Brian Dean [mailto:address@hidden
Sent: Sunday, July 17, 2005 3:39 PM
To: Larry Barello
Cc: address@hidden
Subject: Re: [avr-chat] Atmega128, JTAG and ADC


On Sun, Jul 17, 2005 at 12:48:58AM -0700, Larry Barello wrote:

> if (MCUCSR & _BV(JTRF) != 1)
> {
>       MCUCSR |= _BV(JTD);
>       MCUCSR |= _BV(JTD);
> }
>
> But find that no matter what the code is executed.

Your expression will never be false, since JTRF is bit 4, not bit 0.
I think you want:

    if ((MCUCRS & _BV(JTRF)) != _BV(JTRF)) {
      ...
    }

-Brian
--
Brian Dean
ATmega128 based MAVRIC controllers
http://www.bdmicro.com/






reply via email to

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