We detect you are using an unsupported browser. For the best experience, please visit the site using Chrome, Firefox, Safari, or Edge. X
Maximize Your Experience: Reap the Personalized Advantages by Completing Your Profile to Its Fullest! Update Here
Stay in the loop with the latest from Microchip! Update your profile while you are at it. Update Here
Complete your profile to access more resources.Update Here!

AN544

Title
Title
Math Utility Routines
Name
Name
AN544
Date
Date
06/24/2015
Application Categories
Application Categories
Algorithms (Building Blocks) / Math
Product Categories
Product Categories
16-bit MCUs
dsPIC DSCs
Description
Description
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.

Silicon Products

Title Product Title
PIC17C42A
PIC17C42A