SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
#40229
Hi All,

First, a little background: I've been experimenting off & on with microcontrollers & basic electronics for quite some time (a few years), but never had the time, money or knowledge to do any serious work. The most advanced circuits i've built to date are: controlling leds, 7-segment displays, temperature sensors, eeprom, etc. I don't have any (formal or informal) practical electronics training, so I'm probably missing many of the basic concepts.

Recently, I've decided to build my own simple robot. It will be controlled by a simple microcontroller (PIC16F877A), a L293D motor controller & use simple sensors (bump switches & sharp distance sensors) for object detection. This *should* be simple enough, yet i'm somewhat apprehensive about starting this project because i've always been plagued with the following problem: my PIC chips all seem to break.

Since my resources are quite limited, this is very frustrating and frankly, very discouraging. I'm curious if this is due to my lack of anti-static equipment, the lack of proper programming hardware, or some other cause.

Is this a normal occurrence for the rest of you? Any ideas what I can do to prevent further damage?

Kind regards,

Erik
User avatar
By leon_heller
#40230
Get an ICD 2 or a PICkit 2, they simplify programming and debugging. As the chip remains in-circuit, it's not so likely to get damaged.

Leon
By Andrew02E
#40233
What seems to 'break' about them? There are many ways a PIC can 'break'. Is there any pattern to when they stop functioning? Any similar scenarios that they give up in? Do they completely stop responding or do only certain pins stop functioning? Please add details, I'm sure we can all offer some good suggestions.
Also, I would guess that, although possible, it's not due to a lack of anti-static equipment (unless you rub your TV screen before you start working on it). I rarely handle my PIC projects with care and they've all survived.
By erik006
#40234
The way they 'break' is my inability to program the chips after a few uses: Often the chips will still work (execute the code), and I can read the code from the PIC, but cannot program new code onto the PIC. (My current programmer give an error (for example: ROM programming error at address: 0x0000).

Although i've experienced other problem, this is currently occuring most often. The DIY K150 programmer gives me that error, but i've also tried in circuit programming with a CCS ICD-U40 to no avail.

Erik
#40259
erik006 wrote:This *should* be simple enough, yet i'm somewhat apprehensive about starting this project because i've always been plagued with the following problem: my PIC chips all seem to break.
Erik,

Can you post a schematic of a project you've built that
broke? Did you repair it? If so, how?

Comments Welcome!
User avatar
By Chupa
#40260
erik006 wrote:The way they 'break' is my inability to program the chips after a few uses: Often the chips will still work (execute the code), and I can read the code from the PIC, but cannot program new code onto the PIC. (My current programmer give an error (for example: ROM programming error at address: 0x0000).

Although i've experienced other problem, this is currently occuring most often. The DIY K150 programmer gives me that error, but i've also tried in circuit programming with a CCS ICD-U40 to no avail.

Erik
i started out with a K150 programmer. After looking back its a big mistake, but obviously dident know any better at the time. That programmer is not beginner friendly at all, or even advanced user friendly.

If i had to go back and do it again i would have wanted someone to insist to to me to learn how to do ICSP and use a PICKit 2. It integrates into MPLAB so nicely and later on when you start to catch on you can use it as a debugging tool. The best part is its only $35 http://search.digikey.com/scripts/DkSea ... G164120-ND as appose to the k150 which is like $50 or 60 if I remember correctly, but unfortunately it sounds like you already purchased that.

About your problem with breaking PICs. are you accidentally enabling code protection when you program your PICS? Cus that will cause them to act exactly as you describe.

TLDR: Get a PICkit 2. Learn how to implement ICSP with your circuit.
By Andrew02E
#40261
Chupa brings up a good point with the code protection. I started out with an EPIC programmer, and although it works very well, if you're not careful you can enable/disable all sorts of unwanted configuration settings. This obviously leads to undesired operation (or no operation at all). The point is: double check your programming configuration.
By linuxguy
#40270
leon_heller wrote:Get an ICD 2 or a PICkit 2, they simplify programming and debugging. As the chip remains in-circuit, it's not so likely to get damaged.
I've never worked with the PICkit 2, but I got an Olimex ICD2. It just works, and has never given me any grief. I highly recommend this ICD2. It works great with MPLAB.

8-Dale
By edmoore
#40273
Without wishing to be a pain, you might consider using an Atmega AVR instead of a PIC. There are many tired debates on avr vs pic, but my specific reasoning is that you say you want to really learn what's actually going on in the chips (among other things). The AVR Freaks forum has a beginners section with tutorials, including some absolutely fabulous ones by a user called abcminiuser, which very thoroughly but accessibly explain how the thing works from the registers onwards. I also think that AVRs are a little easier to understand if you're looking at the datasheet and want to understand the architecture, memory mapping and so on. Essentially, once you understand interrupts and timers, it's all down hill, and he explains them both particularly well.

If you're already comfortable with timers and the like, and navigating around the datasheets for your micro, then ignore the above as it'd only be teaching you to suck eggs.

The other advantage to keep you motivated is that avrfreaks is about the most active forum I've come across for this stuff, and the toolchain is completely free and the windows distribution is very well developed and usable.
By edmoore
#40274
Without wishing to be a pain, you might consider using an Atmega AVR instead of a PIC. There are many tired debates on avr vs pic, but my specific reasoning is that you say you want to really learn what's actually going on in the chips (among other things). The AVR Freaks forum has a beginners section with tutorials, including some absolutely fabulous ones by a user called abcminiuser, which very thoroughly but accessibly explain how the thing works from the registers onwards. I also think that AVRs are a little easier to understand if you're looking at the datasheet and want to understand the architecture, memory mapping and so on. Essentially, once you understand interrupts and timers, it's all down hill, and he explains them both particularly well.

If you're already comfortable with timers and the like, and navigating around the datasheets for your micro, then ignore the above as it'd only be teaching you to suck eggs.

The other advantage to keep you motivated is that avrfreaks is about the most active forum I've come across for this stuff, and the toolchain is completely free and the windows distribution is very well developed and usable.
By erik006
#40281
Guys,

thanks for your answers, they are very much appreciated! I will look into getting an ICSP capable programmer, although it seems the ICD2 is a bit out of my reach (financially speaking).

Thanks again,

Erik
User avatar
By Chupa
#40326
erik006 wrote:Guys,

thanks for your answers, they are very much appreciated! I will look into getting an ICSP capable programmer, although it seems the ICD2 is a bit out of my reach (financially speaking).

Thanks again,

Erik
Yea thats why I suggested the PICKit 2. I went from a K150, to a $15 JDM off ebay, to an Olimex PIC Start +, and just recently got a PICkit 2 for debugging.