Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/01/06 04:59
Read: times


 
#119505 - you can also try....
Responding to: ???'s previous message
This is a thing I've used many times before. Viewing the dissasembly in Keil shows it produces good code (does just what we want it to do).

char temp[4];
float f;

temp[0] = ((unsigned char*)(&f))[0];
temp[1] = ((unsigned char*)(&f))[1];
.....


note that you'll have to make sure to get the byte order correct. I usually get it backwards the first time :)

-Dave

List of 9 messages in thread
TopicAuthorDate
Integarting and disintgration of float            01/01/70 00:00      
   Float to Byte            01/01/70 00:00      
   use a union?            01/01/70 00:00      
      Use a union, but ...            01/01/70 00:00      
         Might not matter...            01/01/70 00:00      
   Unwarranted assuption            01/01/70 00:00      
   thanks a lot            01/01/70 00:00      
      you can also try....            01/01/70 00:00      
         again            01/01/70 00:00      

Back to Subject List