Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Saving data to eeprom

Status
Not open for further replies.
Thank for the reply.
Actually, i know how is the routine like to write and read to eeprom. My problem is that i dunnno how to implement it. I suppose to store the calibration value of light sensor to the eeprom so that my main program will know it when my device is first power up. I just don't understand how is the things work from saving the value and read the value.

Here is the example of what have my friend done:

# define FCIN_ADDR 0x00

result= ReadEeprom(FCIN_ADDR);
result<<=8; // i dun understand why must it shift by 8
tem=ReadEeprom(FCIN_ADDR+1);// why must it increment by1
result+=tem;

Regards
 
Last edited:
Thank for the reply.
Actually, i know how is the routine like to write and read to eeprom. My problem is that i dunnno how to implement it. I suppose to store the calibration value of light sensor to the eeprom so that my main program will know it when my device is first power up. I just don't understand how is the things work from saving the value and read the value.

Here is the example of what have my friend done:

# define FCIN_ADDR 0x00


//Reads the high byte and shifts it 8 to put it in the high byte of results.
result= ReadEeprom(FCIN_ADDR);
result<<=8;
// Read low byte and add it to the result which contains the high byte
tem=ReadEeprom(FCIN_ADDR+1);// why must it increment by1
result+=tem;

Regards
The above code reads a 16 bit value from the EEPROM 8 bits at a time.

Given that you did not understand what the <<= operator was you either need
to learn C or have you friend help you.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top