Maker Pro
Maker Pro

Controlling reset of PIC using transistor switch

Hi all,
I am using a PIC18F4520. I need to be able to control the reset/MCLR line (which at the moment is pulled up via a 10K resistor to VDD 3.3V).
I need the control to be software driven rather than have a switch from the pull up to 0V.
What would be the best way to do this?
Could a Logic level N channel MOSFET be adequate? This would be connected between the MCLR line and 0V, cintrolled by a spare I/O line of the PIC.
I am not sure on calculations involved for driving the FET. Also i think i would need to keep the gate of the FET low on switch on to prevent any false resets.

Any help would be aporeciated.
Thanks in advance.
 

Harald Kapp

Moderator
Moderator
There aren't any complicated calculations involved for this simple circuit.
Any logic level MOSFET can be used as long as the gate threshold voltage (Vgsth) is less than the high output voltage of the mcu.
You hold the gate of the MOSFET to GND using a pull down resistor to have the MOSFET off when the mcu is initially turned on - other wise it would keep the mcu in permanent reset.
You'll have to make sure the mcu does not turn on the MOSFET during e.g. startup. Also some kind of filtering to prevent noise from involuntarily resetting the mcu is advised.
upload_2019-3-8_9-36-26.png

R1 C1 make the filter with ~100us time constant to improve noise immunity. increase or decrease the value of C1 for other time constants.
R2 ensures the MOSFET is off without active high level from the mcu output.
I improvised this circuit without any detailed calculations. The values are mostly arbitrary and can be adjusted by you to fit your specific needs.
 
Hi Harald
Many thanks for your help.
I was going to use something similar but without the RC filter. So a pull down from the gate and a resistor from gate to MCU I/O line i.e. like the 1K you have used in your circuit.
I still really want to understand how we calculate these resistor values, for a better understanding. I get that you must have logic high greater than the threshold voltage of the FET. What i dont quite understand is the resistor calculation taking into effect FET input impedance and capacitance etc.
For example why use a 10K pull down instead of a 100K. Why we need a 1K instead of say a 220R.
I look forward to hearing from you.
Thanks in advance
Raj
 

Harald Kapp

Moderator
Moderator
What i dont quite understand is the resistor calculation taking into effect FET input impedance and capacitance etc.
Take the values for these parameters from the datasheet and see if they make any difference to the circuit in this veeeeeerrrryyyy low frequency application. Take into consideration that even with very good components resistors have a tolerance of 1 % and capacitors of 10 % or worse (you don't want to use expensive precision components here ;)).
For example why use a 10K pull down instead of a 100K.
Use 100 k if you feel like it. As I said, all these values are really not critical in this application, I chose them more or less at random judging from experience. That goes equally for the other component values and for the filter time. In an electrically quiet environment you may not even need any of R1, R2 or C1, although I consider it good practice to have them in place just in case.
The thing you'll have to make sureis that the voltage divider R2/(R1+R2) leaves enough gate-source voltage to turn the MOSFET on. How much that voltage is you'll find in the datasheet of the MOSFET of your choice.
 

Harald Kapp

Moderator
Moderator
Why do you want to reset the mcu this way at all? Most mcus have a software reset function, so you don't need additional hardware.
 
The application requires us to be able to reset the micro, before initiating data transfer via UART. It is for a ZigBee application.
What would be a software reset function on a PIC mucro 18F series?
Thanks in advance.
 

Harald Kapp

Moderator
Moderator
btw: Why use an additional transistor at all? You could simply connect an mcu output pin to the reset input - depending on what other circuitry drives reset besides the mcu output.
 
Hi all,
The TX and RX coupled with a reset allows communication to the z wave module.
There is a set time after a reset that the module will look for a sequence of transmit pulses, from this it can recognise that it requires programming.
If the RESET line is pulled high with a pull up resistor. Then can i simply connect this line to another mcu I/O pin? A logic 0 will reset the z wave module? Is that correct?
I do not understand this, especially internally from the pull up side of the z wave module.
Can you explain?
Thanks.
 
Top