Programming the PIC 16F 16F628A and 16F1828

Thread Starter

Wendy

Joined Mar 24, 2008
23,415
Basically I want to write an article for beginners on how to program these two chips. This means I have to do it myself first. I'm looking for good programmers, must be as cheap as possible, but have software. This will ultimately contribute to the Completed Projects forum.

Any recommendations? Remember, low cost and software included (it would be nice if the software was easy to use).
 

Markd77

Joined Sep 7, 2009
2,806
There are programmers that can be hand built, but they rely on using the parallel or usually serial port. I once made one and it worked, but I got a new computer and it no longer worked. The software for them usually only works for a limited range of PICs, and may stop working with a new version of Windows.
I think it's not worth the trouble. Getting a PICKIT2 or PICKIT2 clone is a reliable option, and it's likely, but not guaranteed that the software will continue working with new versions of windows. They also work on Linux and MacOS with official software from Microchip.
PICKIT2 is open source, which explains why clones are available, but to make one you need a programmer for the PIC that it centres around. The clone that I've been using for the last 5 years cost around £12 and has worked perfectly.
<ed>
This is the one I got, it's not a full clone in that it doesn't support in circuit debugging, and won't work with 3.3V PICs but I haven't needed those features yet.
http://www.ebay.co.uk/itm/iCP01-USB...028?pt=LH_DefaultDomain_0&hash=item4165fdb51c
</ed>
 
Last edited:

Thread Starter

Wendy

Joined Mar 24, 2008
23,415
I googled a PIC2 programmer, there were lots of entries. I saw quite a few under $30, but there was something off about them. Software was missing, I think.

Basically this is for the beginner just starting out (hey! That could be me!). I want to minimize the build time, and go from the box (cheaply).

We have several projects out there, which is why I picked the chips I posted.
 

nerdegutta

Joined Dec 15, 2009
2,684
I got good experience with this:

Piccolo - Parallel

Presto - USB

PICKIT3 - USB

The two on top has a free programming tool, you can download from their site. But you need to program and compile elsewhere. I did it in MPLAB. As long as you have a proper *.hex file, the two on top program the chip easily.

The PICKIT3 is programming using MPLAB.

The best (IMHO) development environment or the IDE, if you like, is MPLAB, but it has a steep learning curve. Now MPLAB X is under development, well they have released ver 1 something, and that is far more intuitive than MPLAB v8.xx, but it has a long way to go...

In MPLAB you can choose your own compiler, and I think Hi tech C and Sourceboost are the most popular one.

To choose the right programmer for you, depends if you are going to do In Circuit Debugging. The Piccolo doesn't have that feature. The others do.
 

ErnieM

Joined Apr 24, 2011
8,377
I would have to say starting off with anything but a PICkit 2 or a PICkit 3 is bad advice.

The edge probably goes to the PICkit 3 as it supports more devices. While I own three PICkit 2's my next purchase would be a PICkit 3 (if I ever get such as I also own an ICD 3 which handles everything).

I would also encourage getting the whole development kit so you have known good hardware, software, and programmer (plus a debugger!) to start with. These kits have lessons in assembly and C or Basic to get you up to speed quickly.

It was be especially discouraging as a beginner when nothing is working and you have no idea where the problem could be. By starting with known good items you can confine your troubleshooting list to the new code you have made.

We're taking an investment of $50 to $70 USD to get something very good to work with along with a programmer you can use for years to come.
 

MrChips

Joined Oct 2, 2009
30,714
I agree with Ernie.
I have only one PICkit2 and will soon order a PICkit3.

MPLAB IDE v8.60 does not have PICkit2 support for PIC16F628 and I don't have a PIC16F628A chip.
I compile the program in MPLAB and then use the PICkit2 sw to program the PIC16F628.
 

t06afre

Joined May 11, 2009
5,934
I googled a PIC2 programmer, there were lots of entries. I saw quite a few under $30, but there was something off about them. Software was missing, I think
Huh:confused: PICKIT 2 or PICKIT 3 interface directly with MPLAB and MPLABX. MPLAB(X) is free from from Microchip. And getting MPLAB is the first a newcomer to PICs should do.
I also agree with ErnieM and Markd77. Stay away from anything which tempt with a ZIF socket. A ZIF socket is just flimflams You do your programming IN circuit
 

John P

Joined Oct 14, 2008
2,025
I have a programmer of the very common "Kit 149" type, which is still around at least in name. It came with software that I found very easy to use, and I've worked with several different processors in the 16F series, both in the ZIF socket and using in-circuit programming.

There are cheaper units available now, like the one I showed on eBay (just an example, I have no connection with that particular vendor) but I'm sure they're just as easy to use.
 

Thread Starter

Wendy

Joined Mar 24, 2008
23,415
I would have to say starting off with anything but a PICkit 2 or a PICkit 3 is bad advice.

The edge probably goes to the PICkit 3 as it supports more devices. While I own three PICkit 2's my next purchase would be a PICkit 3 (if I ever get such as I also own an ICD 3 which handles everything).

I would also encourage getting the whole development kit so you have known good hardware, software, and programmer (plus a debugger!) to start with. These kits have lessons in assembly and C or Basic to get you up to speed quickly.

It was be especially discouraging as a beginner when nothing is working and you have no idea where the problem could be. By starting with known good items you can confine your troubleshooting list to the new code you have made.

We're taking an investment of $50 to $70 USD to get something very good to work with along with a programmer you can use for years to come.
Why would you own 3? Not pertinent to the thread, but I am curious.
 

THE_RB

Joined Feb 11, 2008
5,438
Wow you don't want to know how many PIC programmers I have then. ;)

However as others have said you are really best off going for a full featured standard programmer like a PICkit2 or 3.

I'm delighted you want to take that step to start PIC'n Bill, I know you have talked about it before so it's great to see you looking for an actual starting point.

I know this is not what you asked but maybe you could expand the discussion to include some more aspects, particularly what langauge and IDE. Personally I suggest you jump right in with a C compiler as I think this will be both easier and enable greater power and accessibility in your early projects.

As an example a C program to flash a LED at 1Hz on PORTB bit0 might be as simple as this;
Rich (BB code):
TRISB = 0x00;  // all PORTB pins are outputs
while(1)      // perpetual loop
{
  PORTB.F0 = 1;
  delay_mS(500);
  PORTB.F0 = 0;
  Delay_mS(500);
}
As you can see the code is very accessible, where to do that came task in assembler is nowhere near as simple or as easy to write. ;)

Of course some understanding of assembler is nice, but starting in C means you can immediately access some serious math capability and that a great deal of other people's code can be copied direct into your code as C gives a great level of portability.

Personally I use MikroE development boards like the EasyPIC7 (they have a programmer onboard) and they are enormously powerful and fast to bring projects to completion, with features like just "plugging in" a text or graphics LCD and all their boards have a LED and button on every PIC pin, which is very valuable in development. To me that way of working really beats using a "programmer" and a breadboard, which is what I used to do about 14 years ago. Of course the MikroE dev board can also be used to program loose PICs so it essentially does whatever your PICkit2 or 3 does.

Just be warned... Being able to type a list of commands and have a very high speed chip carry out your exact commands to do any task you like is very addictive. :)
 

ErnieM

Joined Apr 24, 2011
8,377
Why would you own 3? Not pertinent to the thread, but I am curious.
I already owned 3 PICkit 2's (one each for home, the office, and a spare) when the PICkit 3 came out, and since that time I got a hold of a MPLAB ICD 3 In-Circuit Debugger.

Now while I absolutely love my PICkit 2 and my ICD 3 I have heard some negative comments about the PICkit 3. In all honesty and full disclosure I have zero experience with #3. It's one of those things that would be "nice" to have but for me not essential.

One day I'll get one just so I can talk about it without waving my hands so much.
 

BMorse

Joined Sep 26, 2009
2,675
I personally would just buy an off the shelf programmer such as the pickit 2 or 3, Microchip offers MPLAB for free, and you can use the student version of their C Compiler to learn C, although you are limited to a 64K program size, but it is still sufficient for beginners to learn from.... when I first started with PICs I used th Pic16PRO kit (http://www.dontronics.com/p16pro.html), I used pads on my circuit for the ICSP connections and made this "chip" clip programmer interface so I just need to clip it on the board and program away, no need to bulky headers or connectors.... :D


...but that is now unsupported and no updates are being made for it unless you can find them on piclist.com.....
 

MMcLaren

Joined Feb 14, 2010
861
Hi Bill (and gang),

I'm also happy to hear you're considering "taking the plunge" into what may become a wonderful and exciting new adventure for you. And while you'll probably share many of the problems and frustrations we've all experienced, those solutions learned "the hard way" are never forgotten and frustrations are quickly replaced by pride in accomplishment.

I use a PICKIT2 clone and it does most everything I need it to do with just a couple exceptions. For instance, the real PICKIT2, PICKIT3, and 100% compatible clones can program the 3.3v PIC devices where my PICKIT2 clone can only do 5v devices.

Another consideration when trying to decide between purchasing a PICKIT2 or a PICKIT3, besides the price difference, it that Microchip is favoring the PICKIT3 over the PICKIT2 when it comes to supporting new devices. For example, the MPLAB interface for PICKIT2 and PICKIT3 allows you to program many devices right from inside MPLAB but so far the PIC 16F1828, a relatively new device, cannot be programmed that way with a PICKIT2. I have to use the PICKIT2 stand-alone programmer application to program my 16F1828. The PICKIT3 however does support programming the 16F1828 from within MPLAB. Anyway, with price tags of $23 and $30 (including shipping) for the reasonably high quality 100% compatible Sure PICKIT2 and PICKIT3 clones, respectively, it's hard to justify not spending the extra $7 for the PICKIT3 clone.

If you're on a budget like me and you enjoy building stuff, then consider building a PICKIT2 clone. I would be happy to post you a programmed 18F2550. That, and another $10 or so in parts and you're in business.

More later, if I may, about your choice of programming languages.

Cheerful regards, Mike
 

gerty

Joined Aug 30, 2007
1,305
We use the Mikroe Electronica EZPic 4 and 5 developement boards. They cost about $125 ea, not cheap, but not too bad. The software is free. The student has to disign a circuit, build the board (point to point wiring) and program the pic. The developement board tells them if the program is working before they insert the ic on thier own board.
Oh yeah , I am NOT a programmer :D
 

Thread Starter

Wendy

Joined Mar 24, 2008
23,415
I tend to be a goal oriented person. My goal at the moment is not to learn the language, though it will happen eventually, but to be able to duplicate some of the projects, using the hex files, to be able to describe to people how to duplicate them for themselves. Some of these project I am actively working on making PCBs for. Seems a lot of the work is drawing things like displays and PIC chips at the moment in PCB Express.

I like the fact they include tutorials though.

Other than a wider range of chippies they can program, what is the difference between a PIC2 and PIC3 programmer? They look pretty similar, and I am under the impression that they operate very similar to each other. There is also a $20 price difference.

I'll refrain from asking specifics until I have one in hand, as I figure it will be much more obvious with a working example and manuals.
 

tracecom

Joined Apr 16, 2010
3,944
Other than a wider range of chippies they can program, what is the difference between a PIC2 and PIC3 programmer? They look pretty similar, and I am under the impression that they operate very similar to each other. There is also a $20 price difference.
Here was Dave Jones' answer to that question.

http://www.youtube.com/watch?v=LjfIS65mwn8

His answer is now out of date. See the Microchip video response to his post.
 

Markd77

Joined Sep 7, 2009
2,806
The PICKIT2 still programs a good range of chips, some of them you have to use the separate PICKIT2 application to program, but that's just a matter of switching to it and clicking program, instead of going to the menu item in MPlab.
I find it a little bizarre, Microchip have a history of supporting older chips, etc, which explains why they keep adding chips to the PICKIT2 application.
As far as I know, there is no reason they can't add those chips to MPLab as well, or just adding all chips to both programmers. They both have upgradable firmware so I can't think of any reason not to, it's probably just adding a few lines to a data file.

I'm currently running the Windows version of MPLab 8 using Wine on Linux, which works pretty well and Microchip have made a command line programmer called pk2cmd for the PICKIT2, I don't think there is anything like that available for the PICKIT3, although MPLAB X should support it on Linux when they finish rounding off the edges.

The PICKIT2 also has a 4 channel logic analyser which is handy for people without one, it's not amazing but a nice feature.
 

coldpenguin

Joined Apr 18, 2010
165
I would definitely recommend a real pickit or icd over a clone.

My first experience was with a clone programmer, only worked 80% of the time, and was one that required the chip to be plugged into it.
So definitely something that can do ICSP, and if possible ICD.
Chip wise, for learning and tutorials, it doesn't really matter too much, so long as it can do something like 16f84a, and I think something like 16f877 (think that has hardware usart), then the reader has learnt a lot, and should be comfortable to nost of the time work out the difference between bad coding, and bad hardware.
 
Top