PIC Programming with PIC KIT 3 - Page 1
Forum section: electronics / general

author: Ecobion
author_rank: Newbie
timestamp: November 13, 2013, 12:03:03 pm
content: I'm trying to get started with programming some PIC chips. I've decided to go down the PIC route, because the chips will be used in a commercial product, I'm starting off with prototyping, will then make small runs, and hopefully end up with large production runs as the final goal.I looked at PICAXE, (thanks to MAKE: Electronics), and saw that all I needed was a cheapy cable, and the free downloadable programming software, a capacitor, and a resistor, or something like that. Seemed great, until I realised how expensive the PICAXE chips are compared with the normal PIC chips, and I found out the reasons for this.Then, I looked at PICs, I can program them in assembly language, or C, both of which I'm confident I can manage (I did a touch of assembly language programming for the Z80 a few decades, so I understand the concepts behind it). So, I've found out there's software available from Microchip to do the programming with, and I have a couple of books on PIC programming (like PIC in Practice, Smith), which also provide a nice outline for codeing for requirements.So, the problem now is how do I get that code into the chips? I'm guessing that the USB cable for the PICAXE chips simply won't work, which is why there's the PIC KIT 3. I saw Dave's You Tube video on this, saw the Microchip follow up video, and looks like it's a good option. I've also seen the Olimex PIC-KIT3 programmer, which apparently, is identical to the PIC KIT 3 by Microchip, and does the same stuff. There's also a K-150 programmer, which is almost as cheap as the chips, certainly cheaper than the PICAXE USB cable, but I understand that support for that is discontinued (which may account for the price), so apparently new chips are not necessarily supported?So,first questionI suppose is, is it worth saving the extra £20 and going for the Olimex programmer? My worry is support, and upgrades.Second questionhere is How do I get my code into the chip? I use program A to write the code, do I load it into program B which is the software for the PICKIT programmer? When I was looking at Dave's video, it wasn't all that clear how one programs the code. It was more obvious on how the code is altered by scrolling through the hex/ASCII-dump.Anyone able to help me progress on this? I need a low budget solution to start me off, but something that is reliable and will be useful for some time to come.

author: dannyf
author_rank: Super Contributor
timestamp: November 13, 2013, 12:13:58 pm
content: You can program via mplab (x) or via standalone programmer software (like pickit2).I actually prefer pickit2 unless your chip isn't supported by it.

author: RoadRunner
author_rank: Frequent Contributor
timestamp: November 13, 2013, 12:38:15 pm
content: i would prefer the microchip's pickit3 programmer because it is supported by the microchip itself.you can use MPLAB IDE with a compiler or assembler to write and compile or assemble the code source into hex file. then you can use either use MPLAB itself or PICKIT3 Standalone programmer software to burn the hex file into the target.for programming with MPLAB IDE you just have to select the Programmer->Select Programmer->PicKit3 . a tool bar will appear with buttons to program,read,erase the memory.and for Pickit3 Standalone application you have to start the stand alone application there you have first select the target device and then load the hex file which is being generated after the successful complication/assembly process. then you can program the target.

author: Ecobion
author_rank: Newbie
timestamp: November 13, 2013, 12:41:38 pm
content: AH HA! Many thanks for explaining the missing step. So, looks very straightforward, and looks like PIC KIT 3 - For compatibility reasons is the better option.

author: RABeng224
author_rank: Contributor
timestamp: November 13, 2013, 12:51:10 pm
content: As others have said, PICkit3 is the way to go. For the price your getting a programmer and debugger, which is a whole lot better than printf style of debugging.If you go the C route, Microchip also offers a free Compiler that is easy to install and integrates with MPLAB X pretty smoothly.

author: Jon Chandler
author_rank: Frequent Contributor
timestamp: November 13, 2013, 02:06:19 pm
content: The PICkit 2 is the better choice unless you're using some of the latest chips that it does not support. It includes the UART tool and logic analyzer that the PICkit 3 does not. Definitely go for the "real deal" from Microchip in either case.Avoid Olimex. I bought one of their USB programmers from Sparkfun. It was always finicky, with a lot of computer rebooting needed for it to be recognized. When a new version of firmware came out I was met with a message something like "Can't upgrade anymore." When I asked Olimex what this message meant, I was accused of making bootleg copies of their firmware. I explained no, I had never even upgraded this programmer before and certainly wasn't making bootleg copies, I was told that Sparkfun must have done so before shipping the programmer to me. That it was an absolute certainty that nothing could be wrong with their copy protection scheme.Sparkfun did replace the micro with one that could be upgraded (from their stash of bootleg copies no doubt) but shortly thereafter I purchased a PICkit 2 and was amazed at how much easier programming a chip could be!You might check out Digital-DIY.com for a lot of PIC programming tutorials.

author: JTR
author_rank: Regular Contributor
timestamp: November 13, 2013, 02:35:55 pm
content: Yep, these days the choice between the PK2 and PK3 is very close. K150 - Run and run fast. Buggy and outdated. No support due to the fact that 95% of sales now are from clones and there was no money to pay someone to keep it up-to-date.

author: gotvolts
author_rank: Contributor
timestamp: November 13, 2013, 03:49:36 pm
content: I would check out CCS PIC developer kits. Very good stuff for the money, although the downfall is that you have to buy their compiler.

author: idolstar
author_rank: Newbie
timestamp: November 13, 2013, 04:51:17 pm
content: I started with PICs recently and got the PICkit3. I've had no problems with it or MPLABX under linux or OS X. I don't know the Olimex, but I can tell you my experience with the PICkit3 is that it has been no hassles and very straightforward.

author: hans
author_rank: Super Contributor
timestamp: November 13, 2013, 10:28:33 pm
content: I prefer the PK2 over PK3 too in terms of usability, but don't let it fear you about getting a PK3. Unless you're switching between many series of microcontrollers (for example jumping from their 32-bit microcontrollers to 8-bit back and forth), it's good.I also thought about buying a 3rd party programmer, but when I looked on Ebay I figured the savings were 10-15$, which isn't worth it for me if I have to fool around with it for even 2 hours.In terms of getting programs up and running. You can use MPLAB or MPLAB X (the newer version in Java) and write your ASM or C code. You compile this code with ASM or XC8/XC16/XC32 compilers to your target chip, depending which you are using. The build process produces a HEX file which can be programmed via the PICKIT3 device, through MPLAB. MPLAB can also do debugging so you can halt the CPU at specific parts of your program and step through it, view memory, etc.You could also program the HEX files via the PICKIT standalone application. However, for the PICKIT3 it doesn't really offer anything over MPLAB, so I don't recommended it. For PICKIT2 it does feature some neat features like Serial Monitor and a small Logic Analyzer, which can be handy. The PICKIT2 standalone program can also program some chips which MPLAB X can't do.

author: lewis
author_rank: Frequent Contributor
timestamp: November 13, 2013, 11:47:51 pm
content: I strongly STRONGLY recommend Gooligum's PIC tutorials -http://www.gooligum.com.au/tutorials.html(scroll down). They are excellent.Pickit3 is a bastard, got yourself a Pickit2. If you're just starting out, you'll probably not be using any of the devices the PK2 doesn't support.

author: dannyf
author_rank: Super Contributor
timestamp: November 13, 2013, 11:52:06 pm
content: QuoteAgreed.QuoteAgreed too.

author: Ecobion
author_rank: Newbie
timestamp: November 14, 2013, 12:17:59 am
content: Thanks again for the great in-depth replies. Just placed an order for a Pickit 3, and a few different PIC processors to start having a play around with.I can see the PicKit 2 was better, but it's the compatibility with new chips that swayed me away from that. As far as the other programmers go, I'm frightened off by the poor support, and potential stability issues.

author: RoadRunner
author_rank: Frequent Contributor
timestamp: November 14, 2013, 04:32:09 am
content: Quote from: dannyf on November 13, 2013, 11:52:06 pmthat video is 4 years old now, the pickit3 has updated very much since then, pickit2 is the better as compare to pickit3 no doubt in that but it does not support lots of new microcontrollers. if you go for pickit2 you are limited in terms of device supported.if you chose between pickit3 or pickit 2 ,go for pickit3.

author: Ecobion
author_rank: Newbie
timestamp: November 14, 2013, 08:05:20 am
content: Indeed, I did make reference to the fact I saw the video in my first post, so I'm not sure why it was posted up by lewis, but thanks all the same, in case other people haven't yet seen it - should just mention again, there was a follow up video by Microchip that addresses a lot of Dave's concerns, which Dave posts a link to on the same video (in the comments underneath), and it was that which got me thinking that PIC KIT 3 was perhaps a good option to go for.

author: gocemk
author_rank: Regular Contributor
timestamp: November 14, 2013, 10:08:43 am
content: My two favorite microcontrollers at the moment are PIC18F45K22 and PIC32MX795F512L and neither is supported by the PICKIT 2. I think you made the right choice by ordering PICKIT 3. I have also ordered one for myself to use it with Mikroelektronika's EasyPIC 7 (8-bit development) and EasyPIC Fusion (PIC24, dsPIC and PIC32 development) along with MPLAB X.

author: lewis
author_rank: Frequent Contributor
timestamp: November 14, 2013, 11:33:55 am
content: Quote from: Ecobion on November 14, 2013, 08:05:20 amJust linking it in for reference.The PK3 is still rubbish compared to PK2, you still need to download new firmware to the unit every time you change device types (going from baseline to midrange for example); the standalone GUI is still crap, it crashes on me on two PCs (in fact, it looks like it's been removed from MCHP's website, so you have to use MPLAB to program); and it does not automatically power the chip to be programmed which can be a real head scratcher as the option to provide power is buried within a few layers of MPLAB menus and defaults to off every time the device is connected. In fairness, I haven't checked MPLABX so it might be easier. There are other idiosyncrasies too.In short, all the points in Dave's 4-year old video are still valid today.But once you get used to its foibles, it's not too bad.

author: dannyf
author_rank: Super Contributor
timestamp: November 14, 2013, 12:02:13 pm
content: QuoteAt least the pic18 is supported by pickit2.Not sure about the pic32.

author: dannyf
author_rank: Super Contributor
timestamp: November 14, 2013, 12:03:52 pm
content: QuoteIt is an excellent programmer, as long as you can live with its various deficiencies.Not sure what Microchip was thinking when they moved from pickit2 to pickit3.

author: RoadRunner
author_rank: Frequent Contributor
timestamp: November 14, 2013, 12:13:49 pm
content: Quote from: lewis on November 14, 2013, 11:33:55 amMPLAB ICD 3 also need to download a new firmware every time you switch the device line. so does this means that PICKIT 2 is better that MPLAB ICD 3?the new standalone programmer application MPLAB IPE is there which replace the stand alone programming application and does support the PICKIT 3 but not PICKIT 2.Quote from: dannyf on November 14, 2013, 12:02:13 pmMany new PIC18 also not supported by the pickit 2i don't exactly remember where but i guess dave also mentioned that the Pickit 3 is better option due to support of new devices.

author: dannyf
author_rank: Super Contributor
timestamp: November 14, 2013, 12:25:11 pm
content: QuoteAbsolutely true, if you need support of such new devices.Otherwise, ...

author: dannyf
author_rank: Super Contributor
timestamp: November 14, 2013, 12:26:27 pm
content: QuoteAnd many new PiC10/12/16/18/24/32 chips.

author: lewis
author_rank: Frequent Contributor
timestamp: November 14, 2013, 01:03:28 pm
content: PK2 supports more newer devices with the updated PK2 device file. Scroll down here:http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en027813But yes, support for newer devices is limited. That's why I use both!

author: JTR
author_rank: Regular Contributor
timestamp: November 14, 2013, 02:43:22 pm
content: If one looks around they will find "user" updates to the PK2 (firmware and Devicefile.dat) that pretty much support all the same devices as the PK3. The real qualifier here is that the new part support is:1) Generally Programmer only. There is some debugger support for newer PIC32 devices but not integrated into MPLAB.2) Third party and only for the PK2 stand-alone app and other third party command line tools.3) It does not integrate into any flavor of MPLAB or IPE.These days I use both the PK2 and the PK3 and it is a pity that you cannot get all the advantages of each rolled into one. Microchip sure fudged the PK3. It is much better now that at release but it has been a long slow grind for PK3 owners...