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? 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!
Learn resistor values with Mho’s Resistance or get the best electronics calculator for engineers “Circuit Playground” – Adafruit’s Apps!
Maker Business — Raspberry Pi and CoderDojo Join Forces
Wearables — Gold glow
Electronics — Linear Love
Biohacking — Nike’s Unlimited Stadium Will Put Your Best Foot Forward
Sorry, the comment form is closed at this time.