|
|
View previous topic :: View next topic |
Author |
Message |
MarcosAmbrose
Joined: 25 Sep 2006 Posts: 38 Location: Adelaide, Australia
|
External Interrupt while in sleep mode. |
Posted: Thu Mar 22, 2007 9:38 pm |
|
|
PIC = 18LF2525
Compiler PCHW 3.429
Howdy, I'm working on a project whereby the PIC goes to sleep and is powered from a lithium battery when Vcc is absent. There is also an external interupt that briefly wake the processer then it goes back to sleep again. Prior to going to sleep I set all the ports to outputs and drive them low. This works well and the processor draws so little current I can't measure it.
However, what I'm having trouble getting my head around is this. The external interrupt is by nature an input, but all the ports are set to outputs while asleep, So my question is how does the interrupt work with this arangement?
-Thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Mar 22, 2007 11:02 pm |
|
|
Quote: |
Prior to going to sleep I set all the ports to outputs and drive them low
But all the ports are set to outputs while asleep, so my question is how
does the interrupt work with this arangement?
|
Even though a pin is configured as an output, the input circuit is still
active and can read the value of the pin.
The output impedance of whatever device is driving the INT_EXT pin
must be low enough so that it's overpowering the pin driver on the PIC.
It might be damaging the PIC's pin driver. What is the external
device that drives that pin ?
A 2nd question would be, why are you setting the INT_EXT pin to be
a low-level output, when you intend for it to receive an external signal ?
It should be configured as an input pin. If the external device that
causes the interrupt is not always attached to the PIC, then put a
pull-down resistor on that pin. You could use 33K. |
|
|
MarcosAmbrose
Joined: 25 Sep 2006 Posts: 38 Location: Adelaide, Australia
|
|
Posted: Fri Mar 23, 2007 5:59 am |
|
|
Quote: | What is the external device that drives that pin ? | It's just a microswitch. It pulls the Int pin high to the Pics supply pin and cause the interupt to trigger on the Low-High transition.
Quote: | A 2nd question would be, why are you setting the INT_EXT pin to be a low-level output, when you intend for it to receive an external signal? | Well thats kind-of part of my original question. Everything that I've read about putting Pics to sleep and minimising current consumption says to make all pins outputs and drive the pins low. But to make the pic Wakeup on interupt, you'd think that pin would have to be an input.
Quote: | If the external device that causes the interrupt is not always attached to the PIC, then put a pull-down resistor on that pin. You could use 33K. | I was thinking the same thing, although I was more concerned that the Interupt pin was floating while the microswitch was open |
|
|
libor
Joined: 14 Dec 2004 Posts: 288 Location: Hungary
|
|
Posted: Sat Mar 24, 2007 8:08 am |
|
|
Quote: | Everything that I've read about putting Pics to sleep and minimising current consumption says to make all pins outputs and drive the pins low. |
This applies mainly to unused pins (to spare the pull-up or pull-down resistors.) The essence of all this is not to have any pin floating: you can do it either by setting them as output, or setting them to input but pulling them up/down at the same time with (an external) resistors. Port B has internal pull-up resistors in most PICs, you can use this also.
If you use a pin as an input with a switch, you should not leave it floating anyway in neither state of the switch, (even when the PIC is awake), so you have to pull it up/down with a resistor.
Having set a pin to output low, and pressing the switch which connects this pin to high stresses the pin's driver in the PIC beyond the allowable max.current, (doing so you might have destroyed that port already, though I found many PICs survived such abuse luckily :-) |
|
|
|
|
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
|