Maker Pro
Maker Pro

sleep mode for PIC

Rajinder

Jan 30, 2016
568
Joined
Jan 30, 2016
Messages
568
Hi
I am using a PIC 18F4550 and want to put it into sleep mode to conserve battery life then wake it up using a 'wake up from interrupt'
My question is what I need to do with the I/O lines?
A basic sleep function will put the PIC into a mode which it consumes around 40uA.
However, if other things such as I/O lines, WDT etc are configured correctly, the current consumption can be reduced further.
Any help would be appreciated.
Thanks
 

kellys_eye

Jun 25, 2010
6,514
Joined
Jun 25, 2010
Messages
6,514
The datasheet should specify the various requirements and/or configurations for sleep mode.

What does the manufacturer say?
 

HellasTechn

Apr 14, 2013
1,579
Joined
Apr 14, 2013
Messages
1,579
I was just about to suggest a datasheet also :) such info would only be found in there !
 

Sadlercomfort

Ash
Feb 9, 2013
424
Joined
Feb 9, 2013
Messages
424
Is your question how to put the microcontroller into sleep mode? Or specifically how to setup the config bits and I/O lines to reduce power consumption?
 

Rajinder

Jan 30, 2016
568
Joined
Jan 30, 2016
Messages
568
It is how to set the configuration bits and I/O bits to reduce the current consumption further.
 

Rajinder

Jan 30, 2016
568
Joined
Jan 30, 2016
Messages
568
Hi,
Thanks all for your replies.
If I make the I/O ports as outputs and drive them low, turn off A/D, UART etc
Would that be enough?
Raj
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Depends on what is connected to the ports. For example, if there is an LED beteen V+ and the port, you would set it to high to minimize current,

Bob
 

Rajinder

Jan 30, 2016
568
Joined
Jan 30, 2016
Messages
568
The program flashes an led on for 1 sec then off for 1 second. The port line driving the led is then made high. Note the led is driven by a pull up to 3v, cathode to pic I,/o line.
The other ports have nothing connected, so I made them all o,/p and driven them low.
The pic uses the internal oscillator.
However using the following inline assembler code after the led is off:

asm sleep;

Results in 4-5mA still being drawn by the circuit. I think it should be around 5uA.

Any ideas?
 
Top