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

PIC24H, retain pin state after power off?

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



Joined: 08 Apr 2009
Posts: 9

View user's profile Send private message

PIC24H, retain pin state after power off?
PostPosted: Fri Aug 07, 2009 4:28 pm     Reply with quote

Is there a way for the pins to retain their states after the power goes off on the device?

Ex: I do an output_low(PIN_A1), next the power gets cut off. I'd like to see the continuity between PIN_A1 and ground when I check with multimeter.

should I just do a soft pulldown to ground in hardware to get the desired affect? my goal is to turn a specific circuit on after the power has been cut, using a PNP transistor.
bkamen



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

View user's profile Send private message

PostPosted: Fri Aug 07, 2009 10:33 pm     Reply with quote

You would have to do an interrupt that's somehow connected to the power input letting you know power was about to keel over.

With the interrupt, you'd save the current state of the pins for the next power up.

The last time I saw this, the input to the interrupt was the INPUT of the local voltage regulator (divided down with protection for the interrupt input)... the regulator had a nice big cap on it to keep the CPU going just long enough so the interrupt could fire, the settings could save and life would be good.

In the case of a PIC, this could be the LowVoltage Detection input or INT0

how's that get you started?

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







PostPosted: Sat Aug 08, 2009 5:01 am     Reply with quote

Power off, no.

The answer already posted, is talking about how to have the chip _re-start_ to the same condition as when power was removed.

The fets, that give the outputs on the PIC, need voltages to drive their gates. Remove the voltages, and they go off. There will be clamping effects from the diodes inside the chip, but not what was being output on the pins. No normal solid state output, can keep it's state without voltage being present. In some cases, you can get this 'effect', by having capacitors inside the device to hold the required voltage, but for normal electronics, the voltage needs to be there.

So, PIC outputs need voltage to work. However _power_ drawn by the PIC, is dependant on the speed the chip is being clocked. You can basically stop the clock on a PIC, leave voltage applied to it and it's outputs, will hold their programmed state. Current drawn like this, falls to nA. You can power a PIC, with it's clock basically stopped, for years, off a small lithium cell. This is the heart of the 'sleep' operation of the PIC.

So, 'power off' (removing the supply from the PIC), no. However 'power down' (making the PIC almost stop using any power), yes. This is how PICs are run in devices like TV remote controls. Sitting with their clock 'stopped', till they see an input change.

Best Wishes
Guest








PostPosted: Sat Aug 08, 2009 8:20 am     Reply with quote

You can use a latching relay to keep the state with power removed - or some scheme with external FET's and a super Capacitor or battery to keep drains high or low when the normal power is removed.

HTH - Steve H.
bkamen



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

View user's profile Send private message

PostPosted: Sat Aug 08, 2009 11:12 am     Reply with quote

Anonymous wrote:
You can use a latching relay to keep the state with power removed - or some scheme with external FET's and a super Capacitor or battery to keep drains high or low when the normal power is removed.



Latching relays -- such a blast! but those would work too! :D
_________________
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