avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Storing float variables


From: Ron Kreymborg
Subject: Re: [avr-gcc-list] Storing float variables
Date: Fri, 6 Apr 2001 23:33:58 +1000

I use a group of functions for each data type. For floats this is:

void eWriteFloat(float *numPtr, void *addr)
{
   BYTE *ptr, *num;
 
   ptr = (BYTE*)addr;
   num = (BYTE*)numPtr;
   eeprom_wb((int)ptr++, *num++);
   eeprom_wb((int)ptr++, *num++);
   eeprom_wb((int)ptr++, *num++);
   eeprom_wb((int)ptr++, *num++);
}

Ron


----- Original Message ----- 
From: "Abiel Fernandez" <address@hidden>
To: <address@hidden>
Sent: Friday, April 06, 2001 10:58 AM
Subject: [avr-gcc-list] Storing float variables


> 
> I need to store a float variable in EEPROM.
> 
> I'm doing this using
> 
>         asm("lds r23,flValor");
> asm("lds r24,flDir");
> asm("lds r25,flDir+1");
> asm("rcall eeprom_wb");
> asm("lds r23,(flValor)+1");
> asm("adiw r24,1");
> asm("rcall eeprom_wb");
> asm("lds r23,(flValor)+2");
> asm("adiw r24,1");
> asm("rcall eeprom_wb");
> asm("lds r23,(flValor)+3");
> asm("adiw r24,1");
> asm("rcall eeprom_wb");
> 
> being flvalor the varible, and flDir the location in
> EEprom.
> 
> Is there another way to do this?
> 
> Thankyou,
> 
> Abiel Fernandez.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]