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 CCS Technical Support

How to Switch Off Pic?

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



Joined: 17 May 2005
Posts: 213

View user's profile Send private message

How to Switch Off Pic?
PostPosted: Thu Dec 27, 2007 12:46 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 27, 2007 2:51 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 27, 2007 2:56 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 27, 2007 7:56 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 27, 2007 8:00 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 27, 2007 8:14 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 27, 2007 8:20 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 27, 2007 8:26 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 27, 2007 8:33 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 27, 2007 8:36 am     Reply with quote

Hi

Thank you all for your replies and help.
I appreciate it!

All the best
a
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