Commandments for Using PICs

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.

Check out the link for even more great tips.


Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7:30pm ET! To join, head over to YouTube and check out the show’s live chat and our Discord!

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Join over 38,000+ makers on Adafruit’s Discord channels and be part of the community! http://adafru.it/discord

CircuitPython – The easiest way to program microcontrollers – CircuitPython.org


New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — New Products 11/15/2024 Featuring Adafruit bq25185 USB / DC / Solar Charger with 3.3V Buck Board! (Video)

Python for Microcontrollers – Adafruit Daily — Python on Microcontrollers Newsletter: A New Arduino MicroPython Package Manager, How-Tos and Much More! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi

EYE on NPI – Adafruit Daily — EYE on NPI Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey

Adafruit IoT Monthly — The 2024 Recap Issue!

Maker Business – Adafruit Daily — Apple to build another chip at TSMC Arizona

Electronics – Adafruit Daily — SMT Tip – Stop moving around!

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !


1 Comment

  1. > “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.

Sorry, the comment form is closed at this time.