0

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.


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, or even use Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for MakeCode, CircuitPython, 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.

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

What do you want from CircuitPython in 2019?

Have an amazing project to share? Join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.

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

Follow Adafruit on Instagram for top secret new products, behinds the scenes and more https://www.instagram.com/adafruit/


Maker Business — Designing hardware is hard. Designing a test jig can be harder.

Wearables — 5 meter fun

Electronics — Solder isn’t everything.

Biohacking — Beyond CBD and THC

Python for Microcontrollers — Python snakes its way on the SparkFun SAMD21 Mini, Hackaday.io, 10k thanks, and Tim’s magazine #Python #Adafruit #CircuitPython @circuitpython @micropython @ThePSF @Adafruit

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.