Microchip logo
  • All
  • Products
  • Documents
  • Applications Notes


Math Utility Routines
Amar Palacherla
This application note provides some utility math routines for Microchip's second generation of high performance 8-bit microcontroller, the PIC17C42. Three assembly language modules are provided, namely ARITH.ASM, BCD.ASM and FXP?DIV.ASM. Currently in each file the following subroutines are implemented: ARITH.ASM ? Single precision 8 x 8 unsigned multiply ? 16 x 16 double precision multiply (signed or unsigned) ? 16 / 16 double precision divide (signed or unsigned) ? 16 x 16 double precision addition ? 16 x 16 double precision subtraction ? double precision square root ? double precision numerical differentiation ? double precision numerical integration ? Pseudo Random number generation ? Gaussian distributed random number generation BCD.ASM ? 8-bit binary to 2 digit BCD conversion ? 16-bit binary to 5 digit BCD conversion ? 5-bit BCD to 16-bit binary conversion ? 2 digit BCD addition FXP?DIV.ASM. As more routines are available, they will be added to the library. The latest routines may be obtained either through Microchip's bulletin board or by contacting your nearest Microchip sales office for a copy on a MS-DOS floppy. These routines have been optimized wherever possible with a compromise between speed, RAM utilization, and code size. Some routines (multiplication and division) are provided in two forms, one optimized for speed and the other optimized for code size. All the routines have been implemented as callable subroutines and the usage of each routine is explained below. At the end of the application note, the listing files of the above programs are given.
Application Notes & Source Code
 Last Updated
  AN544 Source Code
Silicon Products