View previous topic :: View next topic |
Author |
Message |
Helyos
Joined: 22 Oct 2003 Posts: 22
|
MCLR doesn�t restart the code (include schematics) Why? |
Posted: Thu May 13, 2004 11:42 pm |
|
|
Hi, that is the problem.
I am using 16f876 and a res of 10K conected from 5v. to MCLR (pull-up).
When I disconect the power suply adn connect it, the chip start correctly.
But if I active MCLR line (low active, I connect 1-2 secconds to ground) the chip doesn�t start the code, why?
Thanks
Last edited by Helyos on Fri May 14, 2004 5:42 pm; edited 1 time in total |
|
|
Ttelmah Guest
|
Re: MCLR doesn�t restart the code, why? |
Posted: Fri May 14, 2004 5:02 am |
|
|
Helyos wrote: | Hi, that is the problem.
I am using 16f876 and a res of 10K conected from 5v. to MCLR (pull-up).
When I disconect the power suply adn connect it, the chip start correctly.
But if I active MCLR line (low active, I connect 1-2 secconds to ground) the chip doesn�t start the code, why?
Thanks |
Are you sure?.
Basically, if the signal is being pulled low, the chip will restart. However remember that register values will not be cleared to their 'power-on' state. Also remember that the restart will be quick. On a normal power cycle, a lot of the delay from hitting the switch, is for first the power supply rail to rise, then the oscillator to start, then possibly 'soft' delays (if the fuse is enabled to delay after power is applied before starting). A reset, can be _fast_...
You need to check that the pin is dropping (if it is not, you have found the problem!), and if it is, look carefully at how the code will behave.
Best Wishes |
|
|
Helyos
Joined: 22 Oct 2003 Posts: 22
|
I try that, too |
Posted: Fri May 14, 2004 2:21 pm |
|
|
Hi, first, thanks for your answer.
I tested all posibilities, I will put here the schematics of my circuit.
I know that has to be an electronic problem, because when I connect the power supply it starts correctly, and when I do a software reset (reset_cpu();) it resets and start again correctly, but if I press the reset button (connect the MCLR line with Ground -with or without a resistance-) it seems that reset (clean the display) but it doesn�t start again the program.
I hope that your opinions can help me. Thanks a lot.
Last edited by Helyos on Sun May 23, 2004 5:35 pm; edited 4 times in total |
|
|
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
Just a question! |
Posted: Fri May 14, 2004 11:11 pm |
|
|
This may not be on topic, and don't take offence.
I've seen this style of schematic drawing, it sometimes pops up in application note, and I often wonder who is teaching this style .... ?
OK if that's what you have been taught it's all you know but it sure looks like a mess.
Needles to say I don't like the style.
It does not allow a quick overview of the " function blocks". If you add european logic symbols it would be even worse...
For example:
If you draw a Colpits oscillator this way it can't be possible to identify it at a glance.
A simple tuned circuit would have the coil and capacitor separate and every connection would have to be studied before it became obvious it�s a tuned circuit.
If possible please explain what are the benefits, perhaps the original teacher made some claims about it. I'm seriously interested. |
|
|
frankb
Joined: 08 Sep 2003 Posts: 7
|
|
Posted: Fri May 14, 2004 11:48 pm |
|
|
One thing jumps out. Q1 and Q2 are pinned out wrong AND are connected wrong as drawn. These aren't related to the reset problem but without a thorough H/W design check how many other things might be hooked up wrong? Re-drawing the circuit in a more traditional logical way might shake out a few bugs. The signals have no "flow" the way its presently drawn. Just my 2 cents. |
|
|
Helyos
Joined: 22 Oct 2003 Posts: 22
|
Sorry and thanks |
Posted: Sat May 15, 2004 12:21 am |
|
|
Excuse me, I didn�t know that a scheme could bother so much.
This fellow of schemata I seem to good because at a glance I can see an entire, necessary- and- exact- manner circuit, without need of symbols, but it is my opinion.
Thank you very much for your help with the problem with MCLR.
Greetings |
|
|
frankb
Joined: 08 Sep 2003 Posts: 7
|
Didn't mean to offend you |
Posted: Sat May 15, 2004 7:14 am |
|
|
Sorry Helyos . I was just pointing out some errors that could be causing you problems. If you're comfortable with the way you draw schematics then you are welcome to keep doing it that way.
To trouble shoot your reset problem I would recommend doing the following:
1) Remove Q1 and Q2 from the circuit
2) Replace the PIC. It may be damaged depending on how Q1 and Q2 are really hooked up to it.
3) Disconnect everything else connected to the board connectors. (except power)
4) Verify with a scope or meter that the correct pin of the PIC is being pulled low by your reset signal and that the 5 volt power to it remains stable.
5) If this all looks OK and you still can't reset, measure the current being drawn by the circuit. From what I remember seeing on your schematic your current shouldn't be more than about 20 - 30 mA (without LCD connected). If it's more than that something may still be connected wrong.
I hope some of this helps you find the problem. Good luck and I sincerely appologize if I came on too strong |
|
|
Helyos
Joined: 22 Oct 2003 Posts: 22
|
Thank you |
Posted: Sat May 15, 2004 4:55 pm |
|
|
Thank you very much for your time. I answer your questions:
1) I haven�t the transistors conected. In the schematics they seem are wrong (colector, base emisor) but they are well, I put that order for pins reasons (for the layout)
2) I tested the circuit with 3 micros, the same results in three.
3) If I disconnect all I can�t verify that the circuit resets. I tried disconnect the eeprom, the serial/parallel converter, and the same results.
4) I verify with the multimeter and with an osciloscope the signal, and the signal seems correct, from 4,9 v to 0,1 and then became high again.
5) The circuit (with all connected except LCD) current working well is 8,3 mA (with peaks of 14 mA when the buzzer sounds). If I press reset (MCLR to ground) it became 7,1 mA continously and it doesn�t work. :(
What�s wrong??? I�m desperate... |
|
|
ajt
Joined: 07 Sep 2003 Posts: 110
|
Remove the 2uF capacitor |
Posted: Sat May 15, 2004 7:33 pm |
|
|
You might try removing the capacitor on the MCLR line. The PIC has a noise filter on the MCLR line so the cap is unecessary. Possibly the slow rise of the signal is problematic _________________ Al Testani |
|
|
Guest
|
R4 |
Posted: Sat May 15, 2004 10:04 pm |
|
|
What is R4 doing ?
One side is connected to MCLR and the other side is BMCLR what does BMCLR do ?????
If you are pulling MCLR low by grounding BMCLR of R4 then it will not reset the uP.
The Cap on MCLR is not needed.
If you just cleaned up your schematci and draw it in a conventional mannor, to boot, read the data sheet and perhaps you can get this thing working. |
|
|
ajt
Joined: 07 Sep 2003 Posts: 110
|
R4 and C2 |
Posted: Sun May 16, 2004 8:26 am |
|
|
Actually R4 alone would not keep the chip from resetting. The data sheet says max low input on MCLR is 0.2Vdd. With C2, however, strange things could happen. R4 and C2 should be eliminated in any case. _________________ Al Testani |
|
|
Helyos
Joined: 22 Oct 2003 Posts: 22
|
Disconnected |
Posted: Sun May 16, 2004 12:06 pm |
|
|
The R4 is disconnected and the capacitor is disconnected too. The same results. What�s wrong??? |
|
|
Guest
|
Re: R4 and C2 |
Posted: Sun May 16, 2004 3:01 pm |
|
|
ajt wrote: | Actually R4 alone would not keep the chip from resetting. The data sheet says max low input on MCLR is 0.2Vdd. With C2, however, strange things could happen. R4 and C2 should be eliminated in any case. |
If R4 is pulled low with a PIC output then it would be a potential divider.
Voltage at MCLR could be (using data sheet values)
10K + 1K across 5Volts puts MCLR at 0.45V only if Vol is 0V, and many PIC's are close to that.
However Vol for a PIC pin can be as high as 0.6 V so, if this were a worst case situation MCLR could be at 1.05V ! Which is not ideal is you want to guarantee a reset. It's still OK but not the best...
I think the guy has wired something wrong and can't see the forest for the trees. With that horrible schematic to boot what else can go wrong.
It time ti draw conventional schematics and get a clear overview of what is connected to where... ! |
|
|
Guest
|
Re: Disconnected |
Posted: Sun May 16, 2004 3:21 pm |
|
|
Helyos wrote: | The R4 is disconnected and the capacitor is disconnected too. The same results. What�s wrong??? |
I think you wired something wrong. Hey! even the best of use do that from time to time....
Get this clear, there is no magic about pulling MCLR low. The world has not decided to make pulling MCLR low a major issue....
Assume you have made a mistake and look at it with fresh eyes.
BTW you would be well served if you moved towards drawing somewhat more conventional schematics, after all it's been done for the past 65-75 years (of I've been doing it for 45) and there has to be a reason for it..... it works.
One nice thing about the "normal" schematic is it gives the reader a clear view of the functions available. You may be gifted with being able to keep every connection and it's meaning in your head, but for mere mortals (of which i'm one) need to see the overal view.
Your schematic style is not special to you, I've seen it before. I think it's being taught by some radical school somewhwere and I sure would like to know if they claim any adavantage, becasue there is none.
Example: if you draw 2 transistors and four resistors and 2 power symbols one a page, the way you do, and if you simply lable them the way you do, with a quick glance they would mean NOTHING.
However if drawn in the classic style it would look like a Schmidt trigger or flipflop and it's electrical function/meaning is instantly known. More time does not need to be spent on figuring out and reading all the connection lables of the individual components, as is the case using your style.
OK I'll get off of the soap box now....
Long live classic schematic drawing... |
|
|
ajt
Joined: 07 Sep 2003 Posts: 110
|
rewire |
Posted: Sun May 16, 2004 7:54 pm |
|
|
I agree.... I think that isolating MCLR totally, connecting a 51K resistor to Vcc (with no cap) and grounding the MCLR end of the resistor will surely reset the processor. Resetting a PIC is not rocket science. _________________ Al Testani |
|
|
|