Graham North wrote: > I am reading two 16 bit 2's comp numbers from an A2D. I know one > will be greater than the other. My question is how do I compare > them? Wasn't this JUST discussed here on the list? One easy way is to invert the most-significant bit of each number (by XORLWing the high byte with 0x80), then do a straight subtraction: If (A ^ 0x8000) - (B ^ 0x8000) > 0, then A > B. Inverting the high bit is equivalent to adding 0x8000 (or subtracting 0x8000, if you want to think of 0x8000 as a negative number). In any case, it remaps your [-32768 to 32767] range to [0 to 65535]. -Andy === Andrew Warren - fastfwd@ix.netcom.com === Fast Forward Engineering - San Diego, California === http://www.geocities.com/SiliconValley/2499 -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.