Edward:
Don't tie yourself in knots with your code!
The reason for a good schematic is to see where and what causes such a heavy drain of current in your circuit to pull Vdd down. It is not to see how well you can desolder 1000+ connections as you think.
An NPN transistor needs a little more than 600mV on its base MORE POSITIVE than voltage on its emitter. A PNP needs 600mV LESS on its base than voltage on its emitter. A transistor unlike an FET is a current controlled device. The collector current is the product of base current and the current gain of the transistor. Transistors are made with different gain which is also a function of the frequency at which it operates. That's 101 on transistors. If you need more tutorial on transistors this is not the forum for it!
So if you need to turn on a NPN transistor you need to have two conditions met - voltage at base is higher than 600mv trelative to emitter voltage (=0)and provide sufficient base current to operate the load connected at the collector.
In your case, the PIC supplies 5volt out - you are trying to drive a solenoid. If your solenoid needs some current through its coil to turn it on - what is your solenoid spec? If it needs more current than what your regulator can supply then the 5v regulator will shut down and the solenoid will not turn on.
Solenoid also requires a minimum time to turn on. If your solenoid turn on time is more than 200msec it will just click but will not come on.
Now to your latest code - you turn on portc.2 and then trisc the pin to input! That will not turn off the solenoid unless transistor A is a digital type and connects the base to emitter through a resistor so that when portc.2 becomes input the base voltage drops to zero. Leaving the base open with collector driving an inductive load is a good way to destroy the part.
You must have changed the 5volt regulator and the solenoid from your original unit - Even if you short circuit all output pins of portc the PIC will not draw enough current (that's <200mA) to pull Vdd to 3.5volts. Your post says pause puts you to sleep - do you realize that sleep mode keeps the PIC at its lowest power consumption!!!!!!!
Like Ralph says, post your schematic correctly - if you can't tell a diode from a transistor then you have a long way to travel, my friend.
-warrier




Bookmarks