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

Problem when PIC power on!!!
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: 19231

View user's profile Send private message

PostPosted: Wed Jun 11, 2014 12:48 am     Reply with quote

Switching the oscillator reduces power consumption a little, but is not vital.

Look at the setup_oscillator function.

Much more important is the whole 'ethos' of the routines involved:

1) You want the warning ASAP. This is why monitoring the input rail is a much better solution than trying to use the 5v.
2) Then when you enter the routine, you switch to 'power saving'. Now the oscillator is one part of this, but is probably the smallest part. Every device the PIC is operating needs to be turned to it's 'off' state, and every output on the PIC needs to be switched to the point where least current is being drawn.
3) Then you perform the actual data write.
4) Then the routine needs to sit and keep checking that power actually has gone off. If after a few mSec the power has not actually failed, and the alarm signal disappears, then the code needs to do a 'warm start', resetting the oscillator, switching everything back on, and returning to where the signal triggered.
5) Then you need to consider the order that power fails, and how things will behave if parts have not fully discharged, and where power actually flows as the rails go down. If (for instance), your supply uses a simple linear regulator, and has a 'super capacitor' across the PIC, then as the input fails, the PIC rail will be above the incoming supply. This can destroy standard regulators. Then since the PIC supply will fall slowly and rise slowly, you need to consider the oscillator startup, and how the reset signal will actually be generated. I tend to use chips actually designed to do this. Fairchild, Texas, & National amongst others do 'supply supervisory' chips, that will trigger a fail interrupt, and also generate a reset signal an interval _after_ the supply goes good.

I suspect your problems are actually with 4, and 5. Either the chip is actually still running, so is still sitting in the 'fail' code, or the sequencing of supply rails is leading to hardware problems.
tienchuan



Joined: 25 Aug 2009
Posts: 175

View user's profile Send private message Yahoo Messenger

PostPosted: Wed Oct 15, 2014 10:11 pm     Reply with quote

Ttelmah wrote:

4) Then the routine needs to sit and keep checking that power actually has gone off. If after a few mSec the power has not actually failed, and the alarm signal disappears, then the code needs to do a 'warm start', resetting the oscillator, switching everything back on, and returning to where the signal triggered.
5) Then you need to consider the order that power fails, and how things will behave if parts have not fully discharged, and where power actually flows as the rails go down. If (for instance), your supply uses a simple linear regulator, and has a 'super capacitor' across the PIC, then as the input fails, the PIC rail will be above the incoming supply. This can destroy standard regulators. Then since the PIC supply will fall slowly and rise slowly, you need to consider the oscillator startup, and how the reset signal will actually be generated. I tend to use chips actually designed to do this. Fairchild, Texas, & National amongst others do 'supply supervisory' chips, that will trigger a fail interrupt, and also generate a reset signal an interval _after_ the supply goes good.

I suspect your problems are actually with 4, and 5. Either the chip is actually still running, so is still sitting in the 'fail' code, or the sequencing of supply rails is leading to hardware problems.


Thanks Ttelmah.
I'm repairing this problem, it make me spend a lot time than I think.
In my design, it have some bugs in hardware.
With us support, I have modified respectively with circuit and code to make it run.
- circuit : I adding external reset circuit (with slow down power on ) of Microchip.
- programs: edit HLVD config and LVD interrupts services.
The first, it has better run, the circuit doesn't stop when power on, saved data eeprom when power down.
But it's still unstable, sometimes it don't save data to eeprom.
With this problems, I need some suggestions to solve it.
Thank you for your interest!
_________________
Begin Begin Begin !!!
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