浮点到ASCII转换
Itisoftennecessarytooutputafloatingpointnumber
toadisplay.Forexample,tocheckcalculations,one
mightwanttooutputfloatingpointnumbersusingthe
PICmicro
®
microcontrollersserialport,orusegeneral
purposeI/Otooutputtoaliquidcrystaldisplay(LCD).
Eitherway,thefloatingpointnumbermustbecon-
vertedtoitsASCIIequivalent.Thisdocumentshowsa
specificexampleofconvertinga32-bitfloatingpoint
numbertoASCII.ApplicationnoteAN575contains
24-bitand32-bitfloatingpointroutines.Asubroutineis
providedherethatdoestheconversionandreturnsthe
ASCIIequivalentinRAM.Anexample“main”program
isprovidedtoshowhowtousethesubroutine.MFloatingPointtoASCIIConversionAN670Table2depictsMicrochip’s32-bitfloatingpointregisterAuthors:RickEvansRAMusage.Thebitlabeled“S”isthesignbit.TheseMicrochipTechnology,Inc.registersarecollectivelycalledAARG.ThefloatingpointroutinesrequirethattheargumentsbeputinAARGandBARG(BARGisthesecondargument,sameformatas