At 05:32 PM 2/21/02 +0100, you wrote: >Well this is ofcource correct, however there is an issue with rounding. As >this >would truncate the result, i.e. 2->1, 3->1, 4->2 etc. There's also an issue if the number is negative. In the case of a 2's complement number, you have to duplicate the sign bit if you are doing an arithmetic right shift. The PIC doesn't have a specific instruction for this, but you can left shift with W as the destination to shove the sign bit into the carry, then right-shift the carry in. For unsigned numbers, of course, you'd just clear the carry first. Best regards, Spehro Pefhany --"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com 9/11 United we Stand -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads