avr-gcc-list
[Top][All Lists]
Advanced

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

[avr-gcc-list] Warning message


From: Royce Pereira
Subject: [avr-gcc-list] Warning message
Date: Wed, 03 Oct 2007 11:43:35 +0530
User-agent: Opera Mail/9.22 (Win32)

Hi all,

What does the following warning mean?

warning: comparison is always true due to limited range of data type

Here is the context:
I have a AVR I'm trying to connect to a DS1307 RTC chip via TWI.

To check the integrity of the DS1307 internal ram, I plan to write 4 bytes, 
0x55,0xaa,0x55,0xaa in the 1st 4 loations, & read them back & verify, whenever 
I power up.

My code contains this:

#define CHK_1307        0x55

uint8 twi_read(void)
    {
        //..........
        return TWDR;
     }  
//-----------------------
uint8_t init_1307(void)
   {
       uint8_t ok = 1 ;

      if(twi_read() != CHK_1307) ok= 0;
      if(twi_read() != ~CHK_1307) ok= 0;
//      ^^^^^^
//        The offending line.
        
        return ok;
    }
//--------------------------
Thanks,
--Royce.

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/




reply via email to

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