PDA

View Full Version : Controlling power to a PIC with another PIC



jswayze
- 28th May 2005, 17:04
Hi Again,

My project has an one PIC12F629 dedicated to I/O and one PIC12F629 dedicated to the actual task (flashing some LEDs).

The I/O pic has two PWM inputs, each controlling one output. If the PWM signal is over a certain width, the output goes high.

The second output directly controlls a high-current LED, but the first output is supposed to turn on or off my second PIC12F629.

My current (and somewhat working) solution is for the second PIC to read the signal from my I/O PIC and either run the program or wait in a loop until the signal goes high. For the sake of simplicity, let me just say that there are drawbacks to this method.

What I'd like to do is actually cut power to the second PIC when the I/O line is low and supply power when it is high. I'm not an electrical engineer, so I don't really know the best way to do this. It seems like a bipolar transistor would take up too much voltage (I need all of the 5 volts to run the LEDs) and I'd be concerned with how much current a small relay would use to hold the circuit closed (or open)

Does anyone have any thoughts on the best way to do this - that is, given a 5v source, either supply or cut the full 5v to another PIC?

Thanks,

Jeff

mister_e
- 28th May 2005, 17:25
relay could be used... some reed relay are small and don't need many current.

BUT you can also use transistor (PNP) or a MOSFET (P-Channel) to do the same thing. What is the current needed by the whole i/o PIC with all component attach to?

OR you can also use the MCLR pin on the I/O PIC. By sending a high level to this pin, your program will run and while holding it to ground, it will stop....

jswayze
- 28th May 2005, 20:23
Steve, you've come through again - Thank you!

The MCLR trick was the way to go.

For some reason when I was checking this pin while the program was running I'd still have some random dim flashes of my LEDs - even though the PIC was stuck in a loop... weird.

Anyhow, thanks again.

-Jeff

mister_e
- 28th May 2005, 20:44
what about if you add a PAUSE 50 or a bit much at the top of your code to give time to the internal oscillator to stabilize???