Jon Chandler at Digital DIY offers these Commandments for using PICs. They’re not just applicable to PICs, however — these tips hold true for most microcontrollers and are good to keep in mind. He writes:
1. All VSS and VDD pins on the chip must be connected.
Multiple pins are not put there for your convenience. They must all be connected for the chip to work properly. In the picture below, the VDD pins 11 and 32 must be connected to V+ and VSS pins 12 and 31 connected to ground.
2. Bypass caps of 0.1 micro-farad are to be installed across VDD and VSS as close to the chip as possible.
Bypass caps must be used regardless of any other capacitors in the power supply circuit. These may appear insignificant compared to large filter capacitors or capacitors used for the voltage regulator, but they must be used.
3. /MCLR must be pulled to VDD with a 10k resistor or explicitly disabled in code as Graham has explained.
A floating /MCLR pin may lead to intermittent operation, if the chip operates at all.
[editors note: on a PIC, the /MCLR pin is used to clear flash memory for reprogramming. Failure to tie it high or disable it in software can result in PIC amnesia]
4. Ensure that multiplexed port pins are correctly set up.
Many port pins can have multiple functions depending on how the PIC is configured. When using these pins, ensure that the desired function is enabled. Most notable are pins with analog functions, which often default to the analog state. When planning to use these pins for digital functions, such as driving an LED or reading a switch, the digital function must be specified.
5. If using a development board, verify the purpose and connection of jumpers and accessories on the board, and understand the effect these may have on your circuit.
For example, if the development board has a pot connected to one of the analog inputs, your sensor input will be inaccurate or not seen at all. Digital inputs may never change if the pot is rotated all the way to one end.
6. The first programming step is a blinking LED program.
Trivial and silly, yes. It verifies that the power supply is working, the chip is running, and that the programmer can actually program the chip. If the LED flash rate is set to 1 second, it’s also easy to verify that the clock is operating at the right frequency.
Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.
Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !
> “editors note: on a PIC, the /MCLR pin is used to clear flash memory for reprogramming.”
Minor correction: MCLR on a PIC has pretty much the same function (and same involvement with flash erase) as the RESET pin of an AVR.