int
HKC
coloman50mail at axelero.hu
Sun Mar 28 13:27:17 CEST 2004
Hello ,
Sunday, March 28, 2004, 9:06:09 AM, you wrote:
SL> Ez vajon miért nem müködik??
SL> // Procedure to retrieve a floating point double value from nvram and
SL> return the value.
SL> // address is the location of the double.
SL> double read_double_1306(unsigned char address)
SL> {
SL> double dbl;
SL> *(unsigned char*)&dbl = read_1306(address++);
SL> *((unsigned char*)&dbl+1) = read_1306(address++);
SL> *((unsigned char*)&dbl+2) = read_1306(address++);
SL> *((unsigned char*)&dbl+3) = read_1306(address);
SL> return dbl;
SL> }
double read_double_1306(unsigned char address)
{
double dbl;
*(unsigned char*)&dbl = read_1306(address++);
*(((unsigned char*)&dbl)+1) = read_1306(address++);
*(((unsigned char*)&dbl)+2) = read_1306(address++);
*(((unsigned char*)&dbl)+3) = read_1306(address);
return dbl;
}
SL> // Procedure to write a floating point double value to nvram at address.
SL> void write_double_1306(double value, unsigned char address)
SL> {
SL> write_1306(address++, *(unsigned char*)&value);
SL> write_1306(address++, *((unsigned char*)&value+1));
SL> write_1306(address++, *((unsigned char*)&value+2));
SL> write_1306(address, *((unsigned char*)&value+3));
SL> }
void write_double_1306(double value, unsigned char address)
{
write_1306(address++, *(unsigned char*)&value);
write_1306(address++, *(((unsigned char*)&value)+1));
write_1306(address++, *(((unsigned char*)&value)+2));
write_1306(address, *(((unsigned char*)&value)+3));
}
--
Best regards,
Kálmán mailto:el.engineer at axelero.hu
More information about the Elektro
mailing list