PDA

View Full Version : What is the difference between MCLR and switching VDD OFF-ON?



Demon
- 9th October 2024, 08:17
16F18877
MeLabs U2 USB programmer
Breadboard powered from wall adapter.


I just spent an ungodly amount of hours tracking a problem, turned out MCLR was NOT making a "complete RESET". I had to power down the breadboard and turned it back on for programming to take effect completely.

DAT and CLK only used by MeLabs programmer

Standard MCLR circuit:
- MCLR pin on PIC to 10K to VDD
- MCLR pin on PIC to 100R to MCLR on MeLabs U2 USB programmer
- MCLR pin on programmer to pushbutton to VSS

Power:
- 12V Wall adapter to rocker switch (VDD)
- rocker switch to DC-DC converter
- DC-DC converter to breadboard

My CONFIG in case it's relevant:


#CONFIG
__config _CONFIG1, _FEXTOSC_OFF & _RSTOSC_HFINT32 & _CLKOUTEN_OFF & _CSWEN_OFF & _FCMEN_ON
__config _CONFIG2, _MCLRE_ON & _PWRTE_OFF & _LPBOREN_OFF & _BOREN_ON & _BORV_LO & _ZCD_OFF & _PPS1WAY_OFF & _STVREN_ON & _DEBUG_OFF
__config _CONFIG3, _WDTCPS_WDTCPS_11 & _WDTE_OFF & _WDTCWS_WDTCWS_7 & _WDTCCS_LFINTOSC
__config _CONFIG4, _WRT_OFF & _SCANE_available & _LVP_OFF
__config _CONFIG5, _CP_OFF & _CPD_OFF
#ENDCONFIG

richard
- 9th October 2024, 12:48
the major difference is that a power cycle resets all the bits and pieces that are in play on the breadboard, even the ones that are sulking cause the pic stopped talking to them quite rudely when it was reset

Demon
- 9th October 2024, 20:16
Ok.

So if I wanted a complete reset, I'd be better to do a complete shut-down of power to the entire circuit (USB PIC along with multiple secondary PICs and MCP23017).

Would a pushbutton to a 555 timer that controls a PNP that feeds the circuit be a good way to do this?

Ioannis
- 9th October 2024, 20:47
Why use a 555 and not directly connect the pushbutton to the /MCLR?

Ioannis

Demon
- 9th October 2024, 20:52
Why use a 555 and not directly connect the pushbutton to the /MCLR?

Ioannis

That was my plan. I've been doing that since forever, and it's only now causing problems.

I'm "guessing" it's because I'm using more and more peripherals in the PICs (timers, Interrupts, ADC, PWM, things I didn't really use much). I'm now using a lot more registers, and I'm guessing some of them are easily offended.
:D

Demon
- 9th October 2024, 21:27
10uF and 100K generate a pulse of 1.1 seconds; should be enough for a complete reset of all ICs.

https://www.allaboutcircuits.com/tools/555-timer-monostable-circuit/

amgen
- 9th October 2024, 21:45
one thing that can happen is if you have any +5 volt on any of the peripheral pins, the input to the pins inside the PIC have diodes pointing to the supply voltage and then that 'could' keep the pic from resetting..... then, I don't know what..... maybe back to software instruction to reset....@RESET. Or if you take away/turn off power, would have to turn off the power for all external parts 9795

Demon
- 9th October 2024, 23:49
I'm already using IRFZ44N power mosfets to power some sub-circuits. It's plenty strong to withstand whatever I throw at it.

I was thinking of using a 7404 inverter to get the signal the right way (this mosfet wants LOW to be OFF, the pulse from 555 will be HIGH).

Demon
- 9th October 2024, 23:57
one thing that can happen is if you have any +5 volt on any of the peripheral pins, the input to the pins inside the PIC have diodes pointing to the supply voltage and then that 'could' keep the pic from resetting.....

That is very possible.

This reset issue has cost me several days easily, I remember many frantic hours since I'm testing ADC/Timer/HPWM logic, not understanding why the simplest code mods were not taking; slapping LATB.x diagnostic signals all over the place and watching the Saleae window. I'm just happy I wasn't a complete doorknob all that time. :biggrin:



..... maybe back to software instruction to reset....@RESET. Or if you take away/turn off power, would have to turn off the power for all external parts

Nah, I like bulletproof solutions, even if they heavy-handed. Guess what band I got my online nickname from. :biggrin:


I'm really liking this 555 timer, 7404 inverter, IRFZ44N mosfet idea (mostly cause I thought it up on my own, and I've never used 555 and 7404 ICs before).

Unless you see a fault in my idea?

Ioannis
- 10th October 2024, 10:25
If you have a case like what amgen described, you better have a power cycle. This could be a relay, power MosFet, or a simple enable/disable of the power supply chip, etc.

Ioannis

Demon
- 10th October 2024, 22:40
Got a complete system reset working with a 555 timer, 7404 inverter and IRFZ44N mosfet:

https://www.picbasic.co.uk/forum/showthread.php/26810-System-RESET-works-sort-of?p=156426#post156426