Pic16F883 Power on loop back problem

Thread Starter

Walkerandy48

Joined Oct 7, 2018
16
Hi
I am trying to use a push button (held down) to complete a circuit and turn on a Pic16F883
Let me explain.
The Pic is turned on by pressing a push button to supply 5v to a 2N3904 Transistor Base via a 1K Resistor.
Which acts as a switch turning on the Pic (pic +ve to 5v and Pic -ve to 2N3904 Collector
Emitter to -ve
After boot up routine Output A3 is activated to turn on 5v to 2N3904 transistor Base
Basically I am trying to use A3 to keep the transistor or opto turned on via the 2N3904
Hence when the push button is released the transistor should stay on and keep the pic running.
The Pic must be Hard on/off and not in Sleep or Idle
My knowledge of electronics is rudimentary so I presumed this would work.
I have also tried turning on an opto isolator with a push button and feeding back A3 to keep it on,with the Pic on the output side of the opto.
Neither of these ideas work.
Is anyone able to explain why this does not work.
I have been working on this for over a month and it has become frustrating.
I hope I have explained my problem well enough.
I will attempt to upload a circuit diagram when I when I have worked out how to.
Many thanks.
 

AlbertHall

Joined Jun 4, 2014
12,345
When using the transistor, in what way does it not work?
Never turns on.
Turns on only while button is pressed.
Something else?
 

Thread Starter

Walkerandy48

Joined Oct 7, 2018
16
While the button is pressed the Pic runs and is able to flash an led attached to output C0,this is how I can tell the Pic is up and running.
When I release the button the Pic goes dead.
 

Thread Starter

Walkerandy48

Joined Oct 7, 2018
16
My circuit did have a button as an input to control Pic and a slide switch to turn on and off and I am trying to use just the push button to reduce component costs.many thanks.
 

Thread Starter

Walkerandy48

Joined Oct 7, 2018
16
Its logic low 0v until the chip has booted up then logic high 5v
I'm wondering if during the transition when button is released there is a momentary dip in volts?
I have tried turning on A3 with just an led attached and that works fine with transistor and opto.
I have added the 4001 to stop A3 from sinking instead of sourcing.
Thanks Albert
 
Last edited:

Thread Starter

Walkerandy48

Joined Oct 7, 2018
16
I have considered supply voltage 5v and chip voltage 5v therefore voltage difference is 0v ?
I have also considered 3904 and 4001 both have 0.7v drop across them but the chip will run on 2v to 5.5v
The program is basically start up,turn on A3,and keep it on while flashing C0
I have kept the banks separate in case the flashing led has some affect across the bank.
I wonder if there is a component I can add to keep voltage stable?
 
Last edited:

jpanhalt

Joined Jan 18, 2008
11,087
Anxious to see the code too. It appears you are trying to read a port pin (A3) and output to it simultaneously.

Maybe try reading one pin for the switch status and using another as the switch for your on/off transistor.
 

Thread Starter

Walkerandy48

Joined Oct 7, 2018
16
Ah yes jpanhalt I did miss that bit out.
I have not attempted the input part of this programme yet.
I am simply turning on A3 and attempting to loop it back to the 3904 and keep the Pic turned on.
I will attemp the input part at a later date and perhaps use another button for that.
I have attached an led to A3 to check it is coming on and it is.
I have also tried connecting the 3904 base to +5v and the Pic turns on ok.

Many thanks.
 
Last edited:

AlbertHall

Joined Jun 4, 2014
12,345
Ah yes jpanhalt I did miss that bit out.
I have not attempted the input part of this programme yet.
I am simply turning on A3 and attempting to loop it back to the 3904 and keep the Pic turned on.
I will attemp the input part at a later date and perhaps use another button for that.
I have attached an led to A3 to check it is coming on and it is.
I have also tried connecting the 3904 base to +5v and the Pic turns on ok.
Many thanks.
You might look at this design: http://www.mosaic-industries.com/em...witch-turn-on/microcontroller-latching-on-off
 

Thread Starter

Walkerandy48

Joined Oct 7, 2018
16
Thanks Albert perhaps there may be a clue there as this circuit is a little more complex than mine.
Maybe my circuit is too simple as is my understanding?
I am still none the wiser as to why it will not work,but it would appear to be a problem with the Pic and its parameters as the circuit works with leds replacing the Pic
I will build the circuit again and take some readings.
 
Top