Welcome, Guest
Username: Password: Secret Key Remember me

TOPIC: Commandments for Using PICs

Re: Commandments for Using PICs 9 years 3 months ago #15271

There are a few common problems that lead to unreliable PIC operation.  Base on my experiences and other people posting on the forums, here are several commandments that must be followed.

I've also added some comments about practices that I have found to work well for me.  These are not absolutes, but can smooth the development path.

If having problems with example and tutorial code, also check here for some guidelines.

 

Read full article...

Re: Commandments for Using PICs 7 years 1 month ago #11489

  • Jon Chandler
  • Jon Chandler's Avatar
  • Offline
  • Moderator
  • Posts: 365
  • Thanks received: 352
Article updated to clarify a poor assumption on my part. The text in red has been added.
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.

I had the mistaken idea that this went without saying but I've been proven wrong:

Once the oscillator configuration has been tested and the clock rate verified, do not change the oscillator configuration. If the osciallor configuration is changed, the test must be repeated.

Re: Commandments for Using PICs 7 years 1 month ago #11498

  • majenko
  • majenko's Avatar
  • Offline
  • Fresh Boarder
  • Thanks received: 62
3. /MCLR must be pulled to VDD with a 10k resistor or explicitly disabled in code as Graham has explained.
That should be a 10K resistor and a diode to block the high voltage from the Vpp of the ISCP from entering your power circuitry.

Re: Commandments for Using PICs 7 years 1 month ago #11499

  • hop
  • hop's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 526
  • Thanks received: 46
That should be a 10K resistor and a diode to block the high voltage from the Vpp of the ISCP from entering your power circuitry.

I will 2nd that. I blew up a RTC that way once, at least I am assuming I did since it didn't work after I programmed my PIC. Also, and I cannot confirm this because I do not want to duplicate the issue, but I suspect not using that diode way back when was responsible for many of my programming failures.

Re: Commandments for Using PICs 7 years 1 month ago #11516

  • Jon Chandler
  • Jon Chandler's Avatar
  • Offline
  • Moderator
  • Posts: 365
  • Thanks received: 352
That should be a 10K resistor and a diode to block the high voltage from the Vpp of the ISCP from entering your power circuitry.

I will 2nd that. I blew up a RTC that way once, at least I am assuming I did since it didn't work after I programmed my PIC. Also, and I cannot confirm this because I do not want to duplicate the issue, but I suspect not using that diode way back when was responsible for many of my programming failures.

I've seen MicroChip documents which include a diode and which do not. Here is the diagram from the PICkit 2 manual.



This diagram shows a diode or a series resistor. I can't place my hands on materials from MicroChip that show it without at the moment but I've seen them.

Vpp can be as much as 12.5 volts depending on the chip. If there's no blocking diode or series resistor, this voltage is tied to Vdd via the 10kΩ pullup resistor. What will this do to Vdd? As long as Vdd is a "stiff" (low impedance) source, nothing much at all. The effect is about the same as a pullup resistor to ground.

I don't use a blocking diode and I've never had a problem. If the circuit was powered by a weak battery, Vdd might be pulled up but a battery that weak may lead to corrupt programming anyway. If the circuit is powered by the PICkit or a wall wart, the chances of a problem are pretty slim.
Attachments:

Re: Commandments for Using PICs 6 years 1 week ago #13543

  • Baldor
  • Baldor's Avatar
  • Offline
  • Expert Boarder
  • Posts: 135
  • Thanks received: 91
Jon, what do you give to the Hack a Day guys? This article is featured in Hack a Day links today.( http://hackaday.com/2013/09/08/hackaday ... er-8-2013/ )
Aprendiz de mucho, maestro de casi nada.
Time to create page: 0.249 seconds