On 02/05/2011 14:38, Dave Tweed wrote: >> > Is result only up to 999 (three digits)? > No, the result is three bytes of packed BCD, or 6 decimal digits. > >> > But I don't understand it. > It's relatively straightforward. The combination of the AdjBcd()* calls a= nd the > left shift constitutes multiplying a 3-byte (6-digit) number by two in BC= D. > The original sixteen bit number is converted to decimal one bit at a time > starting with the MSB, by multiplying the BCD result by two and then addi= ng > the next bit from the original binary number. > Thanks. I think some 1960s mainframes actually had instructions to do it this=20 way and then libraries for BCD arithmetic for large amounts of money. JAL has added some features since originally that was written as you can=20 have now arrays and also alias larger types passed as parameter to an=20 array of byte in a procedure. So a "modern" version of that can just take two parameters. Probably for=20 conversion to String or Multiplexed Displays an "unpacked" BCD array=20 version is good. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .