Thisapplicationnoteprovidessomeutilitymath

routinesforMicrochip’sPIC16C5XandPIC16CXXX

seriesof8-bitmicrocontrollers.Thefollowingmath

outlinesareprovided:

•8x8unsignedmultiply

•16x16doubleprecisionmultiply

•FixedPointDivision(Table3)

•16x16doubleprecisionaddition

•16x16doubleprecisionsubtraction

•BCD(BinaryCodedDecimal)tobinaryconversion

routines

•BinarytoBCDconversionroutines

•BCDaddition

•BCDsubtraction

•Squareroot

Thesearewritteninnativeassemblylanguageandthe

listingfilesareprovided.Theyarealsoavailableona

disk(MS-DOS

).Alltheroutinesprovidedcanbe

calledassubroutines.Mostoftheroutineshavetwodif-

ferentversions:oneoptimizedforspeedandtheother

optimizedforcodesize.Thecallingsequenceofeach

routineisexplainedatthebeginningofeachlistingfile.AN526PIC16C5X/PIC16CXXXMathUtilityRoutinesTABLE1:PERFORMANCESPECSAuthor:AmarPalacherlaMicrochipTechnologyInc.SpecProgramMemoryInstructionCyclesPLEASENOTE:ThisapplicationnoteusestheoldSpeedEfcient3537MicrochipMathRoutineformat.Itisintendedforref-CodeEfcient1671erencepurposesonlyandisbeingprovidedforthoseofyoustillimplementingBinaryCodedDeci-FIGURE1:FlowchartforUnsigned