CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

State Machine & EEPROM question ?/?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jacqueskleynhans



Joined: 10 Apr 2008
Posts: 109
Location: Cape Town, South Africa

View user's profile Send private message

State Machine & EEPROM question ?/?
PostPosted: Sat Aug 30, 2008 2:57 pm     Reply with quote

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: 1903

View user's profile Send private message

PostPosted: Sat Aug 30, 2008 3:47 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Aug 30, 2008 4:29 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group