Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   16bit values into 8bit eeprom (http://www.velocityreviews.com/forums/t743747-16bit-values-into-8bit-eeprom.html)

 cerr 02-17-2011 06:31 PM

16bit values into 8bit eeprom

Hi There,

I'm having troubles storing an array of 16 16bit values into an 8bit
I read all weird values... :(. My functions look like this:
void WriteToEEPROM(eevalues* data)
{
int8 i=0;
for (i=0; i<VARNUM; i++){
write_eeprom((i*2),*((int8*)&(data[i]->value)));
write_eeprom((i*2)+1,*((int8*)&(data[i]->value) + 1));
}
}
//------------------------------------------------------------------------------

{
int8 i;

for (i = 0; i<VARNUM; i++)
}

May anyone be able to help me and point me into the right direction?
Thank you!

 Ike Naar 02-17-2011 11:50 PM

Re: 16bit values into 8bit eeprom

On 2011-02-17, cerr <ron.eggler@gmail.com> wrote:
> I'm having troubles storing an array of 16 16bit values into an 8bit
> eeprom and read it back.
> I read all weird values... :(. My functions look like this:
> void WriteToEEPROM(eevalues* data)
> {
> int8 i=0;
> for (i=0; i<VARNUM; i++){
> write_eeprom((i*2),*((int8*)&(data[i]->value)));
> write_eeprom((i*2)+1,*((int8*)&(data[i]->value) + 1));
> }
> }
>
> {
> int8 i;
>
> for (i = 0; i<VARNUM; i++)