- get the format those are stored (your C compiler documentation must tell that )in your memory
- get bytes from memory according to format above
and convert them byte by byte to the ascii acccording
to byte meaning .
This is highly machine dependant, you should be able to what you need if your compiler has the sprintf library function which acts like printf but puts the result into a buffer (memory) from where you can extract the ascii representation of your float.
I also included a routine I found on the net, but as said before this is machine dependant!!!
If you use the IEEE 754 (most usual) norm for float remember:
bit 31 sign
bit 23-30 exponent with excess to 127 (0 es 127)
bit 0 -22 mantissa
then you can eloborate a function which is composed union mixed with estructure for return these fields and then traduce then to ASCII. This union return the fields in BYTES for trasmision over a RS232 channel.
Code:
union {
double num_float;
long int num_longint;
int num_int;
struct dividir{
char byte3;
char byte2;
char byte1;
char byte0;
}bytes;
}number;
and access to fields for this example:
void
tx_float (double num_tx){
numero.num_float = num_tx;
putch(numero.bytes.byte3);
putch(numero.bytes.byte2);
putch(numero.bytes.byte1);
putch(numero.bytes.byte0);
}
then only set the fields for return the sign, exponent,mantissa, if I understand your problem, and with simple function convert it to ASCII code ex. -1.25 e 24. (sign ,mantissa ,exponen)