View previous topic :: View next topic |
Author |
Message |
schmez
Joined: 14 Jun 2011 Posts: 24 Location: St. Louis
|
Reset PIC16 using an IO pin connected to MCLR |
Posted: Thu Sep 08, 2011 7:27 pm |
|
|
I need to do a reset to the PIC (16F690)after performing a function. I need to do the equivalent of a power reset but without requiring manual interface. I want to connect one of the IO pins to the MCLR pin - drive it low so that a reset occurs. I am having trouble with the connection/wiring.
Right now I have a 1k resistor between Vdd and MCLR pin; capacitor between MCLR and ground. My thought is to then connect a 1k resistor from an IO pin to the MCRL pin - so when the IO pin goes low it would force a reset on MCLR - this is not working.
Any suggestions or better ideas?
Thank you - I appreciate your advice. |
|
![](templates/subSilver/images/spacer.gif) |
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Fri Sep 09, 2011 1:31 am |
|
|
Why are you trying to do a hardware reset?
The problem with this is that you must meet the reset timing spec for the PIC. That's impossible with simple hardware as as soon as you drive the IO pin, you loose control because the PIC isn't running: it's resetting! Therefore you must use hardware that will generate the right length reset pulse - a "proper" reset generator (there are plenty out there with extras like watchdog, power monitoring and the like: try Maxim/Dallas, Microchip, Ti and AD). If you are a dyed-in-the-wool hobbyist you can go back to the 70s and brew one up with a 555 if you want... but there are better, more modern ways.
The conventional and much simpler way of doing this is to do a software reset. In CCS simply call reset_cpu(). This though is a warm start and doesn't set all the SFRs to their reset state, but all programs should take care of that by proper initialisation at the start of main().
The PIC and CCS will tell you why it (re)started: reset_cause() will tell you. That can be quite useful.
RF Developer |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Fri Sep 09, 2011 5:00 am |
|
|
RF_D is right on this one ! These new fangled PICs have everything built inside of them and CCS has nice software to do what you want...but.. if you're dead set on doing a hardware resetwith the PIC you could have the PIC toggle a 74123 ret. one shot that feeds the *MCLR pin. Setup right,if you don't hit the 74123, it'll send a pulse to the *MCLR pin and you'll have reset.The 'new' 555 can do the same thing but I made a LOT of watchdog timers using the 74123 in the 70s before the 555 came out.
Yessh that's 40 years ago....do they still make 555s ? |
|
![](templates/subSilver/images/spacer.gif) |
schmez
Joined: 14 Jun 2011 Posts: 24 Location: St. Louis
|
Reset maybe not answer |
Posted: Fri Sep 09, 2011 6:03 pm |
|
|
Thank you for the replies. I was doing a soft reset in the code but the PIC seemed to lock up. What I am doing is writing a string to memory and after executing the function the processor seems to lock up - if I hard reset everything is good. Guess, I should continue debugging to see why the PIC is locking up after I execute a write to memory function. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Sat Sep 10, 2011 5:05 am |
|
|
hmmm...sounds like your string storing function maybe trashing memory used for another variable? Remember you need to make room for n+1 locations( 'PIC'+null is 4 not 3 ).Yup, I'm guilty of forgetting that..... |
|
![](templates/subSilver/images/spacer.gif) |
|