----- Original Message ----- From: "Todd Bailey" Subject: [PIC] A Beginner's simple MCLR questions. > 1.) I'm using a PIC16F872. Sending the MCLR pin low on this device should > always be a hardware reset, right? On the 872, this is correct. > should go to zero, correct? Which means that if all the registers are > cleared at the beginning of the program, they should show up reset to 0x00, > right? The program counter gets set to zero. There are a few status bits that get set, but other registers are unchanged. So if, for example, your program sets the first 5 GP registers to zero, then they will get set to zero after !MCLR goes low, after a delay depending on the sort of oscillator, after another delay depending on whether you have set the power up timer, and then after a delay to execute your code. So it's a LONG time after reset these things get changed. > Do I have something wrong? Is this a simulator issue? A chip can't > ignore a hardware reset, can it? Do I need to breadboard this? I'm not comvinced that the simulator is entirely correct with these sorts of things. Some PICs can ignore a hardware reset, the 872 isn't one of them. > 3.) The actual physical mechanism I have drawn up to trigger this reset is a > NO momentary pushbutton connected to ground on one side and MCLR on the > other, with MCLR tied to VDD through a 10k resistor. I've read on your list > that it's a good idea to put a 220ohm or so resistor line with the MCLR pin > -- similar to the way you'd protect the gate of a MOSFET. Is this true? Yes - wouldn't hurt. If you're not doing in-circuit programming, a capacitor isn't a bad idea. Depending on the sources you have for RF or transients, maybe keeping the pullup small is enough. But if you have RF floating around, or relays nearby, I'd be sure to bypass it. If you are doing in-circuit programming, you need a diode. Generally, this is pretty non-critical. When you are doing in-circuit programming, however, you need to protect your +5 supply from Vpp, and you need the programmer to be able to get !MCLR up to Vpp in a hurry. As far as normal, non-programming, operation, !MCLR can come up at a leisurely pace as long as it doesn't wander around too much. It doesn't draw any current to speak of, so 1K, 10K, 100K probably doesn't matter. On reset, you need to get it below 1 volt, and for operation, above 4 volts, assuming a 5 volt supply. Without providing for in-circuit programming you could probably do almost anything ant it will be alright. Hope this helps --McD _______________________________________________ http://www.piclist.com View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist