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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/30/06 12:10
Read: times


 
Msg Score: +1
 +1 Informative
#119416 - Might not matter...
Responding to: ???'s previous message
Christoph Franck said:
... look very carefully at your compiler's documentation on how the bytes are ordered.

If the sole purpose of this is to write the bytes to EEPROM and then read them back again, the actual meaning of the bytes is entirely irrelevant!
So long as the writing and reading leave the bytes in the same order, it doesn't actually matter at all what that order is!

In fact, it would probably be best to ignore the fact that the data might happen to be a float - just have an ee_write routine that takes a start address and number of bytes to write; eg,
void ee_write( void *pData, unsigned char num_bytes )
You could then just use this to write any arbitrary type of data of any length!
eg,
float float_val;
long  long_val;
int   int_val;
char  char_val;

ee_write( &float_val, sizeof(float_val) ); // Write a float
ee_write( &long_val,  sizeof(long_val)  ); // Write a long
ee_write( &int_val,   sizeof(int_val)   ); // Write an int
ee_write( &char_val,  sizeof(char_val)  ); // Write a char




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