1. 首页
  2. 课程学习
  3. 嵌入式
  4. 浮点到ASCII转换

浮点到ASCII转换

上传者: 2022-10-22 19:52:55上传 PDF文件 139.91 KB 热度 15次

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

用户评论