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 CCS Technical Support

Re: Power failure detection problem.
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ttelmah



Joined: 11 Mar 2010
Posts: 20161

View user's profile Send private message

PostPosted: Mon Aug 12, 2013 9:09 am     Reply with quote

Voltage.

Normally you'd want to have the output enabled, and a little bit of hysteresis applied to give more reliable triggering.
A bit of searching about comparators would give a lot of data.

What is the load current on your 5v supply?. As I said earlier, this 'defines' the time you have available.
How much data are you trying to write?. This defines how long you need.

Best Wishes
jaikumar



Joined: 15 Dec 2006
Posts: 109

View user's profile Send private message

PostPosted: Mon Aug 12, 2013 10:58 am     Reply with quote

current 80mA,

I found with the scope the voltage stays above 4.50V for about 0.5 sec.

There is another question i want to ask.

Example.

Code:
While(1)
{
If (input(power_status)=0)  { savevar();} // gets here every 1m sec
code          // no blocking code
·
·
·
code
}

If in the above code i have 0.5 sec after power off and i get to the polling power status code every 0.5 sec then the savevar function will for sure get executed right?

Regards,
Jai.
Ttelmah



Joined: 11 Mar 2010
Posts: 20161

View user's profile Send private message

PostPosted: Mon Aug 12, 2013 12:23 pm     Reply with quote

You most certainly do _not_ want to be repeating the writing.
You must _not_ be writing to the EEPROM when the power actually fails. This can corrupt the EEPROM.

The sequence should be:

If (fail detected)
write data once
wait for more than the best case that the supply might keep going
If (power has not gone off)
restart

Again the question. How much data are you writing?.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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