I've been messing.. My routine probably wont do what you need... You will need the "dirty" Ftoa() then you can see whats happening, once you know you can switch to sprintf..
C:
char * ftoa(float f, int * status)
{
static char buf[17];
char * cp = buf;
unsigned long l, rem;
if(f < 0) {
*cp++ = '-';
f = -f;
}
l = (unsigned long)f;
f -= (float)l;
rem = (unsigned long)(f * 1e6);
sprintf(cp, "%lu.%6.6lu", l, rem);
return buf;
}
I have used this and its good enough to view whats going on..
I've been messing.. My routine probably wont do what you need... You will need the "dirty" Ftoa() then you can see whats happening, once you know you can switch to sprintf..
C:
char * ftoa(float f, int * status)
{
static char buf[17];
char * cp = buf;
unsigned long l, rem;
if(f < 0) {
*cp++ = '-';
f = -f;
}
l = (unsigned long)f;
f -= (float)l;
rem = (unsigned long)(f * 1e6);
sprintf(cp, "%lu.%6.6lu", l, rem);
return buf;
}
I have used this and its good enough to view whats going on..