piclist 2000\06\08\084956a >
Thread: 32bit binary to ASCII conversion
www.piclist.com/techref/microchip/devices.htm?key=pic
flavicon
face BY : Octavio Nogueira email (remove spam text)



If you want the routine in C here it is:
/*--------------------------------------------*/
/* d - number to display                      */
/* dig - number of digits                     */
/* dec - decimal point position               */
/*--------------------------------------------*/
void print(unsigned long d, char dig, char dec)
{
unsigned long n;
char i,j;

n=1;
for(i=dig;i!=1;i--) n*=10;

while(n!=1)
{
 if(d>=n)
 {
  j=(d/n) % n;
  putch(j+0x30);
  d-=j*n;
 }
 else
  putch('0');
 n/=10;
 if(--dig==dec) putch(',');
}
putch((d % 10)+0x30);

}


Friendly Regards

Octavio Nogueira
===================================================
.....nogueiraspam_OUTspamRemoveMEpropic2.com                  ICQ# 19841898
ProPic tools - low cost PIC programmer and emulator
http://www.propic2.com
===================================================

{Original Message removed}
<004f01bfd147$d4b86240$1c8dd5c8@octavio>

See also: www.piclist.com/techref/microchip/devices.htm?key=pic
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) 32bit binary to ASCII conversion

month overview.

new search...