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 power disconnected

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



Joined: 11 May 2006
Posts: 78

View user's profile Send private message

Problem when power disconnected
PostPosted: Fri Jan 05, 2007 3:02 am     Reply with quote

Hello,

I have created a program that runs with very low current consumption when the PIC is asleep, ~3uA.

The PIC wakes up from sleep with an interrupt from a pin. The pin must be held low for 3 seconds, then the PIC will wake and go into normal operate mode.

I have a problem with the pic in normal mode. If I disconnect the battery from the PIC and then re-connect it the PIC does not resume from where it was nor does it restart the program instead the PIC does not respond to any input from the user at all.

It is as if the PIC has gone into some intermediate state where it will not respond.

I am using a 16f688
and the first thing it does is to go to sleep (after setting up PIC).
FUSES are:-
NOWDT
PUT
INTRC_IO
NOBROWNOUT
NOIESC
NOFCMEN

Please can anyone help!!

(I cannot post too much code due to security but I will try and accomodate as much as possible).

Many Thanks

S Harris
libor



Joined: 14 Dec 2004
Posts: 288
Location: Hungary

View user's profile Send private message

PostPosted: Fri Jan 05, 2007 4:57 am     Reply with quote

Two ideas:
- Try it with BROWNOUT enabled (this would prevent the PIC going into indeterminate state upon temporary low voltage)
- Use the Watchdog to reset the PIC when the code goes astray or execution freezes.
sjharris



Joined: 11 May 2006
Posts: 78

View user's profile Send private message

Thanks
PostPosted: Fri Jan 05, 2007 5:18 am     Reply with quote

OK,

I know that with Watchdog timer I have to reset it otherwise it resets the PIC but do I need to with brownout as well?

PS What is the correct way to set up WDT on 16F688 ?

PPS Can I set the WDT to reset at any given delay, e.g. 60 seconds?

Thanks

Also is there a difference between Brownout and Software Brown Out??

Thanks again
libor



Joined: 14 Dec 2004
Posts: 288
Location: Hungary

View user's profile Send private message

PostPosted: Fri Jan 05, 2007 5:39 am     Reply with quote

No. The BROWNOUT feature enabled will reset the PIC when supply voltage drops below a certain level, read the manual for the values. You don't have to regularly 'reset' the brownout detector in software like the watchdog. It will work by itself.
You can however check for what reason a reset has occured in software in the beginning of your code and act accordingly if you wish.

Do you have any I/O pins receiving power into them when no power supply present ? This can also cause a random latch-up you observe.
sjharris



Joined: 11 May 2006
Posts: 78

View user's profile Send private message

PostPosted: Fri Jan 05, 2007 5:50 am     Reply with quote

When the PIC is in normal operate mode (powered and out of sleep) there are 3 with a possiblity of a fourth pin that could be powered. But when the power is disconnected there is no power to these pins.

There maybe a bit of cap discharge through one of the pins that is set to an output, could the caps be discharging through the output pins on the PIC?
libor



Joined: 14 Dec 2004
Posts: 288
Location: Hungary

View user's profile Send private message

PostPosted: Fri Jan 05, 2007 6:10 am     Reply with quote

Does a hardware reset (pulling low the MCLR pin) bring the PIC out of this indeterminate state ?
You can read this Application Note AN607 for some clues. Here
sjharris



Joined: 11 May 2006
Posts: 78

View user's profile Send private message

PostPosted: Fri Jan 05, 2007 6:59 am     Reply with quote

I have now read the app note and have disconnected the caps that may be powering the pins to the PIC. This has not solved the problem. I may need to add a brownout circuit!!

Any other help would be most apreciated.

Thanks

SHarris
sjharris



Joined: 11 May 2006
Posts: 78

View user's profile Send private message

PostPosted: Fri Jan 05, 2007 7:35 am     Reply with quote

I think my problem stems from the fact that the power supply is disconnected abruptly.

Would the brownout detect this sudden drop in voltage or does it need a ramp to enable the brownout?

Would a cap discharging across the Vdd be better?


Dont worry about the cap idea, too much leakage current.


Thanks

S Harris
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