EEprom for saving time inputs

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I hope this question isn’t to lame . I 'am still learning on using EEPROM Memory for the use that I need for it.

I don't want to store any constants just data that changes . I have a timer that counts down and restarts with the user option to change count down time . When the device is powered off all time data goes away as its not stored in EEPOM . .

 

All I would like to do is save time to eeprom after user has updated it and then when user powers up timer it restores where it left off .

Integer values only are being saved and read .

 

If the user enters 1:05 I want to save to eeprom 1 and 5 ,save it to eeprom and then update if user changes time. after device powers on it will pull that and update time to match .

 

Using atmel studio 6 and atmega8

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you have a question there? I guess you know how to use the EEPROM, if not there is a thread in the tutorial forum.

 

Remember that the EEPROM has a lifetime of 100,000 cycles.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok,

Are you using Studio for your IDE?

C or ASM?

 

If C, then as John noted there are threads in the Tutorials forum.  Here is one that a member wrote that is pretty good:

http://www.fourwalledcubicle.com...

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think THE EEPROM will out live me, I don't see a way of writing code for storing local variables  into the EEprom area but giving up is hard to do .

 

 

I looked at deans tutorials rather helpful but only see constant values being stored .

 

I have Atmel Studio 6 C++  , Atmega 8

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't see a way of writing code for storing local variables  into the EEprom

Do you mean this:

#include <avr/eeprom.h>

uint8_t temp;

void foo(void)
{
uint8_t hour, minut; // local vars
   hour = 5;
   minut = 6;

   //write hour to adr 10, minut to adr 11
   eeprom_write_byte ((uint8_t*) 10, hour);  
   eeprom_write_byte ((uint8_t*) 11, minut);  
   _delay_ms(10);
   
   //read byte from adr 10, 11
   temp = eeprom_read_byte ((uint8_t*)10);
   temp = eeprom_read_byte ((uint8_t*)11);
}

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Visovian , Yes that's exactly what I was looking for its working great.

 

Thank you very much .

 

Thanks to everyone that got me going in the right direction not use to forums but I did learn allot .

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

chrislundberg wrote:
I think THE EEPROM will out live me, I don't see a way of writing code for storing local variables  into the EEprom area but giving up is hard to do .

 

WHat?

 

 

Didn't you read Jim's post?

 

jgmdesign wrote:
If C, then as John noted there are threads in the Tutorials forum.  Here is one that a member wrote that is pretty good:

http://www.fourwalledcubicle.com/AVRArticles.php

 

Jim

There's a link that says "Using the EEPROM in AVR-GCC