13

I've been looking into doing some PIC Programming, but unlike some of the other microcontrollers available the sheer number of different chips available has caused me some confusion. It also appears that some of the chips suggested on some sites as good choices for people starting out with PIC programming may have been superseded (or I may just be getting even more confused).

So my question boils down to three parts:

  • What would be a good PIC chip to start out with?

  • I'm quite happy doing either assembler or some other language, so what IDEs/languages would you suggest for Linux?

  • What would you recommend in terms of getting the code onto the chip, over a USB connection from a Linux laptop (PicKit 2? was one possibility) and what circuit/board configuration will I need to do this?

Edit: After a long discussion with Kortuk (see comments below) on the merits of various bits of kit, I've decided to start with the PicKit2 Starter Kit. This comes with a PIC16F690 chip installed.

PeterJ
  • 17,131
  • 37
  • 56
  • 91
Amos
  • 2,893
  • 3
  • 26
  • 26

6 Answers6

7

I agree with PIC18s but for someone just starting they may be a bit intense. I currently teach senior level electrical engineers PIC development and even within the same classes their range of backgrounds can be astounding.

I currently teach people with the CCS PIC-C compiler but it costs money. It is unbelievable simple and was chosen as most of our students have only worked in a lab setting with basic assembly or x86 programming.

I have a feeling a very simple PIC16 may be a better fit, but it will depend on your background. The PIC16F688 is a very simple PIC that we use for our first project to warm people up.

PeterJ
  • 17,131
  • 37
  • 56
  • 91
Kortuk
  • 13,362
  • 8
  • 60
  • 85
  • 1
    I have a First Class Honours Degree in Computing which included lots of programming (C++ mainly, a bit of VB6, some assembler). I also have a degree in Maths and teach Maths to Secondary School kids. I can and do program in a variety of languages (not C though) and am looking into various new things including playing with Microcontrollers. – Amos Nov 15 '09 at 14:27
  • The 16f88 was one of the chips I was looking into. – Amos Nov 15 '09 at 14:27
  • Just reread your answer and realised you specified the 16f688 not 16f88. – Amos Nov 15 '09 at 19:48
  • 1
    The 16F88 is a perfect choice. There are a million different PICs out there, and I think about 50,000 of them are good for starting. Programming Microcontrollers very often posses problems to people I have helped with a CS background because they did not take many classes about electricity, something I wish they would add to degree programs. I do not think the programming will be challenging at all though, but it would probably not be a bad choice to get your a development board. This would be affected by your price range. http://www.microchipdirect.com/ProductSearch.aspx?Keywords=DV164120 – Kortuk Nov 15 '09 at 21:58
  • 1
    I think that last link I posted might be a good choice, it will give you a board already wired up to work with for 50 dollars(-25% if you have a .edu email) and then you have a programmer you can use for any other chips you get. I look forward to hearing how your projects go. – Kortuk Nov 15 '09 at 21:59
  • These were exactly the boards I was looking at last week. Although I think the 16f88 is 18 pin so would I need to get the board for 18 pin chips too, which is about £15 extra? – Amos Nov 16 '09 at 11:06
  • I am not sure what the question is, that sounds perfectly reasonable to me. – Kortuk Nov 16 '09 at 12:00
  • The one you linked to (Pickit 2 starter Kit) comes with a board which is good for 8, 14 and 20 pin chips, I was just checking that I would need to also buy the DM164120-4 board too, in order to cope with an 18 pin chip which is what the 16f88 is. I was checking because at least one site I went to last week implied that the DM164120-1 board which comes with the kit would do for 18 pin PICs too. – Amos Nov 16 '09 at 17:12
  • 1
    If you get the DM164120-1, I would suggest you use the PIC that comes with it. I am right in the middle of helping someone with a project that they need to teach class tomorrow or I would look more, but every place I find your board I cannot find it's schematic. I can tell you based on the pin-out of the PIC16F631 it is not compatible with a PIC16F88. The power and programming pins will not line up. If you buy a dev board, just use the PIC that comes with it, you will be significantly happier. – Kortuk Nov 17 '09 at 02:00
  • 1
    This page: http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en531769 shows boards that are compatible with the PicKit 2 and 3. In the second box down it states that the DM161420-1 "Does not support PIC10F 8DIP or 18-Pin Devices." and then has the DM161420-4 which is 18 pin compatible. There don't appear to be any schematics lower down the page for the 18 pin, but there are for the other board in the users guide. So I'm guessing thats the way to go then if I do go for the 16F88 as a starter.Alternatively the 18 pin board comes with a PIC16F648A. – Amos Nov 17 '09 at 21:57
  • 2
    Yes, you have done your research well. My help may have been a little misguided. If you want to get your feet wet, a development board is a way to avoid dealing with the hardware of building a PIC before you are ready. If you go this path, I would suggest using the PIC that comes with the board and determine your next choice of PIC after you are ready to build your own boards. If you want your own pic from the beginning, buy a programmer, the pic and anything you need to run the pic from the start. You can save money and use a breadboard. – Kortuk Nov 18 '09 at 04:31
  • 1
    I think that I'll go with the PicKit 2 Starter Kit then, and add new chips/boards as and when. This seems like a reasonably cheap option initially as I get can the kit direct from microchip for £31.24 which includes a development board and chip (16f690). Cheers, now to find some decent tutorials/books. – Amos Nov 18 '09 at 10:49
  • 1
    Hey, if you order it with an account you registered using a .edu email you will receive a 25% discount. – Kortuk Nov 18 '09 at 13:21
  • MicrochipDirect has a UK based section which may be different to the US one. My School account ends .co.uk, when they are registered specifically to schools here they tend to end .sch.uk, Universities tend to end .ac.uk. I might see if they do have any discounts anyway, even though it's for my benefit not the School's, they tend to be quite flexible like that. – Amos Nov 18 '09 at 14:25
  • 1
    The discount has nothing to do with the school gaining benefit, it is about not charging a college(Uni) student as much. I would suggest trying your luck. – Kortuk Nov 18 '09 at 20:13
  • I meant that as our Domain name ends .co.uk, School would have to verify my link to them probably. But they are quite good about such things even if the benefit to the School is not immediately apparent. Although if I'm not careful I'll end up teaching electronics to randomly selected students next year, as that seems to be the way of things at times, especially if the Tories get in. – Amos Nov 18 '09 at 22:10
  • Ohh, I understood, I have quite a few friends from the UK. I was just telling you that being a student is all they require, it can be a personal project. – Kortuk Nov 19 '09 at 00:18
4

For the PIC, there is an open source compiler called JAL (Just Another Language)

Like other programming languages it allows the possibility to use hardware libraries to greatly simplify the process of attaching your chosen PIC to other hardware. The software also will allow you to compile and upload programs via your PIC2 (or a clone of this programmer)

JAL is a Pascal based language and is free software (always nice if your just starting out)

JAL Wiki Entry

As for books, "PIC Microcontrollers, 50 projects for beginners and experts" By Bert Van Dam is worth a look at as an introduction to JAL

So far I have used just the 16F877A chip from PIC, a good beginners chip apparently. Pretty cheap and lots of ports available.

Justblair
  • 1,006
  • 2
  • 8
  • 10
  • Cheers, I'll have a look. Does JAL use a specific IDE, there one available for Linux? – Amos Nov 18 '09 at 22:03
  • 1
    Yes it has one called JAL Edit, it will keep you right on the coding side and has a the typical tools that you tend to find on IDE's http://jal.sunish.net/jaledit – Justblair Nov 18 '09 at 23:09
  • Unfortunately that's Windows only, there does appear to be one for Linux called PicShell, current Beta is at: http://linux.softpedia.com/get/Text-Editing-Processing/IDEs/Picshell-52408.shtml – Amos Nov 19 '09 at 09:54
2

For chip look at the 18F series, allmost as cheap as the 16F a lot more guts. 18F2550 is a nice chip and includes USB, there are others in the same series. Take a look at microchips selection charts on their website.

Free IDE from microchip including C which you should use over assembler IMHO. Not sure if microchip IDE runs on Linux but it may.

PicKit may be good for programming, may want to burn a bootloader the first time then bootload over usb. The Bitwacker ( google it ) is a nice setup to use or copy.

There are a ton of forums and other sites, just google. One problem with the PIC is that there are so many languages and none are quite the same ( even within c compilers ) If you can write a good question ask on piclist.com, but do your homework first. Forums are not the best place for learning, look for tutorial sites for that ( again the bitwacher site is good, also google "Embedded Adventures" the guy has done a lot in C ( but not the microchip one )

russ_hensel
  • 2,904
  • 16
  • 12
  • I've bookmarked Embedded Adventures for when I've got an hour or two to kill, and had a look at the Bitwacker for future reference. Cheers. – Amos Nov 17 '09 at 21:59
1

For references to some stuff, I have done a little programming with the PIC using Pik Kit 2 Pickit 1, I would recommend the 100 microcontroller projects for the evil genius, I also have some blog posts that are dealing with such things

http://blog.onaclovtech.com/2010/01/interrupts.html

http://blog.onaclovtech.com/2010/01/analog-inputs.html

http://blog.onaclovtech.com/2010/02/pic-16f913-quick-reference-guide.html

http://blog.onaclovtech.com/2010/02/pic-16f913.html

I plan to post a SPI update as well as when I figure out how to deal with CAN bus traffic using some microchip chips, I'll have updates then too.

Thank you,

onaclov

onaclov2000
  • 439
  • 4
  • 15
  • Looks interesting, I'll have a closer look at your stuff when I get a minute. – Amos Jul 20 '10 at 06:55
  • I maybe just don't know where to look all the time, but feel like compared to avr and arduino there are practically no tutorials on PIC's and I would really like to change that.... – onaclov2000 Jul 20 '10 at 13:20
1

If you want to use PICs I would seriously consider the PIC24 series of 16 bit pics or the very similar dsPIC33. They are faster, more powerful, in many ways easier to program, and don't cost any more than the most basic 8 bit ones. The lower end ones are available in breadboard friendly DIP socket packages too.

It's a lot harder to find examples on the internet though, but as far as i can see that's the main disadvantage.

John Burton
  • 2,086
  • 4
  • 23
  • 34
1

The Dwengo board is based on the PIC18F4550, they also have a low-cost PICkit2 clone and some very good tutorials to get you started: http://www.dwengo.org/tutorials

Wim
  • 432
  • 2
  • 7