View previous topic :: View next topic |
Author |
Message |
jacqueskleynhans
Joined: 10 Apr 2008 Posts: 109 Location: Cape Town, South Africa
|
State Machine & EEPROM question ?/? |
Posted: Sat Aug 30, 2008 2:57 pm |
|
|
Say i have a state machine :
//**This will happen once**//
-Get adc values
-Calculate Calibration constants
-Store Calibration constants in eeprom
-Read Cal Constants from eeprom
//**Normal Loop**//
-Get adc value
-Use constants
-Print result
The question: Do i need to read the cal constants every time in my normal loop to be able to use them or can i simply read them once everytime my mcu restarts/resets, so that they will be available for the code to function correctly.
Kind Regards
Jacques Kleynhans _________________ "THE ONLY EASY DAY WAS YESTERDAY" |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1911
|
|
Posted: Sat Aug 30, 2008 3:47 pm |
|
|
Read once. Normally the initialization of calibration constants and other things that are "read once" is performed prior to the main while(1) { } loop of the program. Once a variable is set, it doesn't change unless your code changes it. Very rarely a hardware issue can cause these sorts of things to change, but if I were you I wouldn't worry about that. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sat Aug 30, 2008 4:29 pm |
|
|
I basically aggree. However for safety related systems, there are standards , that require a different processing. A periodical repeated integrity check of code and data (e. g. by CRC) would be necessary then. If calibration data are hold in volatile memory, they have to be checked, too. Reloading them and performing a typically already existing check would be easier in this case. |
|
|
|