Danny said:
Andrew Holme wrote:
Good news (for me!)... I just got my first breadboard circuit working! I
think my problems had all been down to MCLR! I just created the circuit
you've been helping with here, but without the motors (and without the
Vdd->Vss cap, since I don't have them yet!). It just flashes two sets of
LEDs on and off, and has the unused pins (and inputs I don't yet have
switches for) tied to ground with resistors.
W00t! That's the hard part - now I can get programming world peace
instead of just LEDs! =)
I just removed the 4.7K resistor on my breadboard, and it still works
the same. I'll ignore this in future
I just looked at the datasheet for the 16F676, and it specifies a
resistor of at least 1k, along with an optional cap of 0.1uF to ground.
This is on pg 58 of the 16F630/16F676 datasheet.
Also, note that MCLR can be used to avoid problems when the voltage
comes up too slowly. Microchip sells a part specifically for this (the
MCP100 series, if memory serves) that will keep MCLR low until the
voltage comes up enough for the system to run. You can also build a
circuit like this fairly easily, or just ignore it and tie it to Vdd if
you aren't worried about it. However, MCLR problems seem to be endemic
to the microchip product line for some reason.
I thought they where LEDs, but thought I'd cover all bases

Ironically, the lowest resistor I have here is 1K, so I've had to use
them for my test, and the LEDs glow fine - I guess there's no point
giving them more power if they don't need to be brighter

(or maybe he was using his dads old resistor box too!)
I see. Is there any advantage to connecting all the ground together from
different sources to just having them totally seperate? Is it just to
make wiring easier, since any ground will do? Would this cause any extra
noise from things like motors?
Ground is the common reference point in your circuit. Without it, you
can't connect up the parts of your circuit. This is because voltage is
not an absolute measure, it's a relative measure. Thus, when you signal
from one part of your circuit to another part using voltage you must
reference that voltage signal to something. That something is ground.
Note, however, that ground isn't always the same. Wires have a little
resistance and inductance, and so the more current that flows over them,
and the more it changes abruptly (as in motors), the more voltage will
be across them. Consequently, grounds that have lots of current can be
different than grounds that have only a little current. Just something
to keep in mind.
Actually, many microchip parts have internal "weak pullup resistors",
which can be turned on and of individually for port pins. They are 10k.
Look at the datasheet for your part.
I was just bitten by this, in that I forgot about the internal pullups,
and wondered why my 100k resistor wasn't pulling the input to ground.
Turning off the pullups fixed the problem.
Ok, so what *exactly* is the resistor doing? What does it do when it's
given say 0, 3, 5, 7 volts?
I see. Does the same hold for my circuit? I've got +5V, connected to a
resistor, then to both the input pin and a switch. If I *know* my chip
is an input (eg., I've tested it *with* the resistor), is it safe to
remove?
The initial value for parts from reset is to be an input, I believe.
Unless you explicitly change this, they will never be an output.
However, you are not taking into account possible software errors that
may creep in at a later date. Prudence suggests that you provide for
this possibility by using a resistor.
Don't know, it's not explained, and the assembly's pretty long... I'll
just ignore this for now
--
Regards,
Robert Monsen
"Your Highness, I have no need of this hypothesis."
- Pierre Laplace (1749-1827), to Napoleon,
on why his works on celestial mechanics make no mention of God.