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

Has anybody got the save before power down working properly?

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



Joined: 15 Dec 2006
Posts: 109

View user's profile Send private message

Has anybody got the save before power down working properly?
PostPosted: Mon Nov 29, 2010 3:47 am     Reply with quote

Hi all,
The application requires saving of 4 bytes to either internal or external eeprom before power off.

If we create a circuit such that to make pic work for a while before power down. We run in to other problems such as pic not resetting properly
due to capacitor not allowing the voltage to go down properly to reset the device.
Could any body give me some ideas for a proper circuit which would work.

Thanks & Regards,
Jai.
Ttelmah



Joined: 11 Mar 2010
Posts: 19231

View user's profile Send private message

PostPosted: Mon Nov 29, 2010 5:23 am     Reply with quote

Not really to do with circuitry. All to do with code.....

Multiple things. Don't try to hold the supply 'good' longer than you need. Trigger an interrupt to say 'supply failing' at a point you determine (say 4.5v). Then on a typical PIC, you can write to EEPROM, down to perhaps 3v. As soon as the interrupt fires, cut off all circuitry you can to save power. If your PIC supports changing clock speed to an internal clock, do this down to the slowest clock available. Perhaps 32KHz. Your consumption should then be under 50uA. Capacitor needed to give just 1v of drop over (say) 25mSec (four writes, plus a bit extra), is then only 1,.25uF!. Something like the typical 10uF, handles this easily....
Then once you have written the bytes, carry on monitoring the fail input. If the power recovers, turn the clock back up, and return from the routine. The commonest problem is a 'brownout' situation, where the supply drops enough to trigger the write, but then doesn't actually go off.
Use the chip's watchdog as well. The whole 'point' of this is to reset the device, when it remains alive, but has got somewhere it shouldn't.

Best Wishes
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Nov 29, 2010 12:46 pm     Reply with quote

Ttelmah wrote:
Not really to do with circuitry. All to do with code.....



Well, there are some little tricks on the hardware side that can help.

I remember a embedded 6805 app (that's sitting on my desk) back when micro's still slurped from the power supply of life...

The trick used on that to help "save" the config on power loss was to put a threshold detect on the INPUT side of the a V+ supply to show the loss of power before the 7805's output filter cap would run out of juice. Plenty of time.

That trick could still be useful today with the smaller caps we'd like to use and so forth.

But after that, like TTelmah says, the rest is code.

Cheers,

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
Ttelmah



Joined: 11 Mar 2010
Posts: 19231

View user's profile Send private message

PostPosted: Mon Nov 29, 2010 1:05 pm     Reply with quote

Yes,
Doen't someone like National, do a 'supply monitor' chip, that monitors the incoming supply, and generates both an interrupt, and a reset output?. Used one of these a while back for an app like this, and it helped simplify things a lot.
It depends masively on the nature of the supply involved, but if there is an incoming unregulated rail, this is well worth considering.

Best Wishes
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Nov 29, 2010 1:49 pm     Reply with quote

Ttelmah wrote:
Yes,
Doen't someone like National, do a 'supply monitor' chip, that monitors the incoming supply, and generates both an interrupt, and a reset output?. Used one of these a while back for an app like this, and it helped simplify things a lot.
It depends masively on the nature of the supply involved, but if there is an incoming unregulated rail, this is well worth considering.


So many chips, so little time.

With something like the PIC and all the models and flexibility, I'm sure it could be worked into the PIC's features...

I was just describing the method of monitoring that could still be useful... but it could be implemented so many ways.

So many chips. Hahah.

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
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