[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-chat] Atmega128, JTAG and ADC
From: |
Richard Urwin |
Subject: |
Re: [avr-chat] Atmega128, JTAG and ADC |
Date: |
Mon, 18 Jul 2005 00:47:40 +0100 |
User-agent: |
KMail/1.5.3 |
On Sunday 17 Jul 2005 11:39 pm, Brian Dean wrote:
> 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)) {
> ...
> }
>
I think == 0 might be even better.
No need to give the compiler a hernia trying to optimise your code.
Especially when the shorter versions is more readable.
--
Richard Urwin
- [avr-chat] PID Tutorial/ Examples, Royce & Sharal Pereira, 2005/07/15
- Re: [avr-chat] PID Tutorial/ Examples, Christopher X. Candreva, 2005/07/15
- Re: [avr-chat] PID Tutorial/ Examples, Royce & Sharal Pereira, 2005/07/16
- Re: [avr-chat] PID Tutorial/ Examples, Richard Urwin, 2005/07/16
- [avr-chat] Atmega128, JTAG and ADC, Larry Barello, 2005/07/17
- RE: [avr-chat] Atmega128, JTAG and ADC, Ben Mann, 2005/07/17
- Re: [avr-chat] Atmega128, JTAG and ADC, Brian Dean, 2005/07/17
- Re: [avr-chat] Atmega128, JTAG and ADC,
Richard Urwin <=
- RE: [avr-chat] Atmega128, JTAG and ADC, Larry Barello, 2005/07/17
- Re: [avr-chat] Atmega128, JTAG and ADC, Brian Dean, 2005/07/17
- Re: [avr-chat] Atmega128, JTAG and ADC, Jeff Epler, 2005/07/17
- RE: [avr-chat] Atmega128, JTAG and ADC, Larry Barello, 2005/07/17
Re: [avr-chat] PID Tutorial/ Examples, Alan Kilian, 2005/07/15
Re: [avr-chat] PID Tutorial/ Examples, Richard Urwin, 2005/07/15