View previous topic :: View next topic |
Author |
Message |
arrow
Joined: 17 May 2005 Posts: 213
|
How to Switch Off Pic? |
Posted: Thu Dec 27, 2007 12:46 am |
|
|
Hi
I would like to switch off the pic (not put it into sleep mode) in the middle of the code (in an if block).
Can someone please tell me how to do this?
Thank you in advance.
a. |
|
|
libor
Joined: 14 Dec 2004 Posts: 288 Location: Hungary
|
|
Posted: Thu Dec 27, 2007 2:51 am |
|
|
You can cut off the pic's own power if you put a PNP transistor (or better,. a FET) in the power supply line, with another one, a NPN pulling its base low when active (applied high on its base). This circuit must be started manually, will be runnnig as long as the PIC keeps the output high. The PIC can commit suicide by pulling low the port (switch off its own power, one-time after manual restart of course) |
|
|
arrow
Joined: 17 May 2005 Posts: 213
|
|
Posted: Thu Dec 27, 2007 2:56 am |
|
|
Hi Libor
Thank you for your reply.
I was wondering if there is a software way to switch off the PIC?
Regards
a. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Thu Dec 27, 2007 7:56 am |
|
|
Do not forget that if you switch off a PIC you also lose its control.
There are a lot of MCU with nanoWatt low sleep features, that properly configured,
drain only a few microamps.
Humberto |
|
|
arrow
Joined: 17 May 2005 Posts: 213
|
|
Posted: Thu Dec 27, 2007 8:00 am |
|
|
Hi Humberto
Thank you for your reply.
I really need to switch off the PIC. I am contemplating to use a goto statement which will send the program to the end. Is there a better way of switching off?
Thank you
a. |
|
|
Heath
Joined: 21 Dec 2007 Posts: 41
|
|
Posted: Thu Dec 27, 2007 8:14 am |
|
|
Please give some more information. What do you mean by 'switching off'?
What is the objective? What are you trying to accomplish by 'switching off". |
|
|
arrow
Joined: 17 May 2005 Posts: 213
|
|
Posted: Thu Dec 27, 2007 8:20 am |
|
|
Hi
What happens if I put the PIC into sleep mode and then switch off the power to the PIC?
Will this damage the PIC?
When I reapply the power will it be in sleep mode?
Thank you
a. |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
Posted: Thu Dec 27, 2007 8:26 am |
|
|
The answer to your first question is the PIC simply stops running and goes to sleep.
The answer to your second question is no, it will not damage the PIC.
When the PIC is powered on it will always come up in normal run mode (third question) unless you put it back to sleep with the SLEEP() command (which is the answer to your earlier question).
See page 229 of the latest manual for info for what happens in sleep mode with the SLEEP() command.
As was said earlier, to completely remove power from the PIC will require some external circuitry.
And finally, READ the DATA SHEET and the CCS Manual, they will answer many (if not most) of the questions that you ask.
Last edited by dyeatman on Thu Dec 27, 2007 8:33 am; edited 1 time in total |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Thu Dec 27, 2007 8:33 am |
|
|
With most PICs if you use an external clock you can just stop the clock. When you restart the clock the PIC will continue where it left off, but you must keep voltage applied for the PIC to keep its status. The power draw with no clock is minuscule. This will not work with a PIC using a PLL clock.
If you put a PIC in sleep mode, kill power, and re-apply power it will go through a normal power-on restart and start running the program from the beginning. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
arrow
Joined: 17 May 2005 Posts: 213
|
|
Posted: Thu Dec 27, 2007 8:36 am |
|
|
Hi
Thank you all for your replies and help.
I appreciate it!
All the best
a |
|
|
|