Thanks to Scott Dottalo who replied to my query by email; he said: >P.S. I didn't post this to the list because I think the code is >too long. If you think otherwise, or if you think someone else may >benefit, then feel free to post it. >A linear transfer function is extremely common in A/D >applications. I've used them in several instances to >compensate/calibrate hardware. In my experience, the general >purpose floating point computations have been too slow. Similarly, >I suspect the BCD computations you allude to will also be slow. Speed is not a problem for the current project, as the display update interval can be as long as 1 second. Assuming a 4 MHz clock, ie. 1 usec instruction cycle, a 24-bit f/p multiply would take 313 usecs maximum according to app note AN575. A complete calulation using several milliseconds would be perfectly ok. What I'm looking for is the kind of routines used in a 4-function calculator. I'd guess that implementing one of those on a PIC would not be competitive, although there must be PIC-based special function calculators. I started working on an algorithm to convert the floating point binary to decimal; for instance 111.111 binary means 1 + 2 + 4 + 0.5 + 0.25 + 0.125 decimal. The method would deal with the integer and fractional parts separately, generating the BCD equivalent of each power of 2 and adding it to a running total if the bit was 1. Naturally, I'd rather use code (or even an algorithm) that was already available. Regards, D.M. ps. Here's a summary of the routines Scott mentioned: +------------------------- ;scale_hex2dec ; The purpose of this routine is to scale a hexadecimal byte to a ;decimal byte. +------------------------- ;write_byte_as_dec ; ; The purpose of this routine is to convert a byte to a 3 digit ASCII string ;representing the decimal value of the byte. For example, 0xff = 255 is converted ;to 0x32 0x35 0x35. +------------------------- ;BCD_2_ASCII ; ; The purpose of this routine is to convert the BCD byte in W into two ASCII bytes. +------------------------- ;write_word_as_dec +------------------------- ;BCD_adjust ; ; This routine will 'adjust' the byte that W points to to BCD. The ;algorithm is based on converting hexadecimal into decimal. +-------------------------