On 29 Oct 2011 at 0:40, Oli Glaser wrote: > On 28/10/2011 20:48, Yigit Turgut wrote: > > readEepromByte(0x00) + (readEepromByte(0x01)<<8); > > > > readEepromByte(0x00 + (readEepromByte(0x01)<<8)); > > > > They are equivalent aren't they ? They should be because it still > > doesn't respond logically (: > > > > >=20 > The first will add the two function return values together (one left=20 > shifted by 8), whilst the second will use the (left shifted) return=20 > value from the second (right hand) function (+ 0x00) as the argument for= =20 > the first function. Not to mention that shifting left by 8 places is likely to zero an 8 bit in= teger (if that is=20 the variable size returned from your function, and if your compiler has no = good=20 reason to think otherwise). To ensure 16 bit width in the shifting and addi= tion you=20 probably need to use some typecasting, eg: (unsigned int) readEepromByte(0x01) << 8; --=20 Brent Brown, Electronic Design Solutions 16 English Street, St Andrews, Hamilton 3200, New Zealand Ph: +64 7 849 0069 Fax: +64 7 849 0071 Cell: +64 27 433 4069 eMail: brent.brown@clear.net.nz --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .