> Dear all, > > I read from datasheet regarding OV flag. > > "This bit is used for signed arithmetic. It indicates an overflow of the > 7-bit magnitude, which causes the sign bit to change." > > Is that mean whenever the MSB toggled (not include the result from bsf & > bcf), this flag will be set? > > Thanks & regards. > > WH Tan > I am assuming you are referring to an 18F series PIC. Actually, the description is true, but rather poorly worded. What it could say is: This OV bit is used for signed arithmetic. When adding or subtracting two eight-bit signed values it is possible for the correct result to not be representable as an eight bit signed value. This bit is set in those cases. For example: +100 decimal +100 decimal ------ +200 OV will be set, because +200 is not a valid eight-bit signed value. The same this will happen with -100 decimal -100 decimal ----- -200 Note that it is never possible to get an overflow if the operands are of opposite signs (for addition), or the same sign (for subtraction). Bob Ammerman RAm Systems -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads