PDA

View Full Version : PIC chips..... where to start



Steve2381
01-26-2012, 11:08 AM
Hi all

Pretty much exhausted the Basic stamps now..... currently playing with Propeller chips.

However, for several smaller projects I have going, I am pretty sure PIC chips would be better suited - as the functions I need are pretty simple.

There are SO MANY Pics! Where the heck do I start.
I have been trying to work out what the differences between all these chips is (some are obvious)

Anyone recommend a good starter kit - USB connected?

Thanks
Steve

Heater.
01-26-2012, 11:17 AM
There are SO MANY Pics! Where the heck do I start.

Exactly. And when you have stocked up with a few PICs you will find that your next project idea can't be done with them because you don't have just the one with the right combination of features that day.

So, stock up on Propellers, they may be overkill for some jobs but they are a blank slate that can be used very flexibly.

Leon
01-26-2012, 11:19 AM
This kit looks quite good:

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en539716&redirects=picdemlab

There are much cheaper options, such as buying a PICkit and a few chips and wiring up your own board. In that case, here are some nice tutorials:

http://www.gooligum.com.au/tut_baseline.html

The PIC18 family is much easier to use than the other 8-bit devices, and it might be better to start with those.

Bean
01-26-2012, 11:40 AM
Steve,
I've been using some pics recently because I need a very small processor.
The PIC10F322 has just come out and it is available in a SOT-23 size.
I would suggest staying away from the 12 bit core devices. They are a pain to use.
I use the 14-bit core devices.
As for a programmer, I'd get the PICKit3.
And you'll need the adapter for whatever device you want to program. Or you can do what I do, and just connect wires from the programmer to the device pins.

Bean

Steve2381
01-26-2012, 12:14 PM
Mmm... but propeller and stamp chips are just so bloody expensive.
I love using stamp chips, but most projects just don't warrant the cost of the stamp.

Read good/bad about the pickit3 programmer (as in - pickit2 was far better), but I expect it doesn't make a lot of difference.
Who uses what software for programming (I see some kits come with discs)

Looks like a learning curve ahead again!

Bean
01-26-2012, 12:20 PM
Steve,
The IDE for PICs is called MPLAB. You can download it from Microchip.
I got the PicKit3 because the PicKit2 doesn't support the 10F322 in MPLAB.

I don't know if you can still buy it, but the PicKit1 is good for beginners. It has LEDs, button, pot, etc on the board.
For a good all-around generic Pic I like the PIC16F688.

Bean

Erik Friesen
01-26-2012, 12:23 PM
I too recommend going with the 18 +, as you can code C. This would also be a good starter - http://www.microchipdirect.com/ProductSearch.aspx?Keywords=DV164131

If you want to do assembler, the pic16f688 is a classic that would be a good starting point. If you can stand spending the money, get the icd3, its a lot faster, although I can't get mine to work with mplabX.

bill190
01-26-2012, 02:31 PM
So far as getting started with PIC's, just start reading!

Everything is 400 pages!
Microcontroller Data Sheet, MPLAB IDE documentation, C language, Assembly, etc.

And they don't tell you obvious things. All throughout a microcontroller data sheet it will reference "FOSC". But nowhere does it say what "FOSC" is!

FYI - It is the entire oscillator block diagram and your chosen output speed of that. Or "Flexible Oscillator Structure".

Fully understand "FOSC" and the "Configuration Bits", then you will be off to a good start.

Then look at specific pins in the data sheet. For one pin it might say...

RB5/AN13/CPS5/P2B(1)/CCP3(1)/P3A(1)/T1G(1)/COM1

...those are all different things that pin can be used for! And to use the pin for one thing, there may be "configuration bit" settings which need to be on/off. Or other settings relating to other things which may need to be turned off. So you are best to read through the data sheet about all of those things the pin can be used for and be sure the settings for the things you are not using are off.

And poke around the Microchip web site to see all the documentation available. There are all sorts of papers written on specific topics like Capacitive Touch, Interrupt on Change, Energy Saving, USB, etc.

Then nobody understands PWM by just reading the data sheet! For that there is a cheat calculator here...

(Note it says: "This calculator will save you from insomnia and headaches!")
http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html

Phil Pilgrim (PhiPi)
01-26-2012, 03:24 PM
Even though many Parallax forum users use (or have used) PICs, this is a forum primarily for Parallax products. You may find the following to be a richer and more complete source of info for Microchip products:


http://www.piclist.com

-Phil

Heater.
01-26-2012, 03:35 PM
Yes, Props are more expensive.

Even so one might find it cheaper and easier to have some Props on hand than a draw full of PICs that don't quite fit anything you want to do and don't get used.. And it saves waiting around for the right ones you have ordered to arrive. I still have a pile of PICs and AVRs sitting unused. And as pointed out it saves all that endless waiting through 400 page manuals.

So unless you have a production run it's worth thinking about.

rod1963
01-26-2012, 05:01 PM
Try the PicAxe series of micros. They run on Basic and are dirt cheap($2.95 on up) and come in a variety of sizes from 8 pins to 40 pins.

Nice chip for those one-off non-demanding apps that don't need a 32bit processor.

Sparkfun among others sells them.

davejames
01-26-2012, 07:06 PM
Pretty much exhausted the Basic stamps now.....

Being recently reminded that I'm still a noob, could you explain (for my education) what you mean by the above?

Admittedly I've just scratched the surface of the Stamp's capabilities in using it as just a simple controller, but I've seen what others have done in exercising its math and bit handling features.

Why and how, in your usage, has the Stamp been "exhausted"?

I'm just curious, I'm attempting to learn, I'm not insinuating anything - just asking.

Thanks much.

erco
01-26-2012, 08:46 PM
Try the PicAxe series of micros. They run on Basic and are dirt cheap($2.95 on up) and come in a variety of sizes from 8 pins to 40 pins.

Nice chip for those one-off non-demanding apps that don't need a 32bit processor.

Sparkfun among others sells them.

+1

Martin_H
01-26-2012, 10:39 PM
While I like objects and methods offered by Spin on the Propeller or C++ on the Arduino. I find PBASIC on the stamp nice too. The built in commands and tons of sample code available means you can knock out stuff quickly. I wouldn't try kinematics on it without a coprocessor and servo controller, but for line following or roaming with sensors it is more than adequate.

Franklin
01-27-2012, 03:50 AM
There are SO MANY Pics! Where the heck do I start.
In most cases you start with a project and a need, then you find the hardware and chip that will most closely fit your needs.

Steve2381
01-27-2012, 08:03 AM
OK. Thanks guys. I have plenty to read and think about.
I will research all the links you have thrown up, and see what fits my needs best.

My comment about exhausting Basic stamps really means that I can program them with my eyes shut. The reason I moved on to Propeller chips is because, every time I start a Basic chip project, I end up running out of development room.
The have their limits. It all comes down to what you are building and picking the right components.

The reason for the PICs... its something else I have at my disposal. For those silly little 2" square mini projects that don't need a huge amount of programming.
Plus... it niggles me when I see a PIC chip and I have no idea how to use it (within reason).

For an exmaple of pushing a Stamp to its limits.... the classic alarm clock I made a good few years back...

http://www.youtube.com/watch?v=vCgMDY-Sg1Q

Thanks all
Steve

bsnut
01-27-2012, 09:23 AM
I would suggest after you read all this. Is a Velleman PIC kit which comes with its own PIC chip and you can get it from Radio Shack stores or from their site.

Steve2381
01-27-2012, 11:39 AM
The Picaxe stuff looks pretty good I have to say (for what I need). Is this just a variation of a standard PIC then? Is the programming the same or more basic?

http://www.techsupplies.co.uk/epages/Store.sf/en_GB/?ObjectPath=/Shops/Store.TechSupplies/Products/AXE091U

This kit seems to cover a lot of bases.
Steve

rod1963
01-27-2012, 04:19 PM
In the words of the PicAxe people - "A PICAXE chip is a standard Microchip PIC microcontroller that has been pre-programmed with the PICAXE bootstrap firmware code. The bootstrap code enables the PICAXE microcontroller to be re-programmed 'in position' directly via a simple 'three wire' download cable connection.." The newest versions(X2 series)) uses the PIC18F25K22(28 pin) and PIC18F45K22(40 pin).

davejames
01-27-2012, 04:36 PM
For an exmaple of pushing a Stamp to its limits.... the classic alarm clock I made a good few years back...

Again, attempting to understand...sorry for being thick.

Is the limit mentioned above and the comment about "running out of development room" related to the number of I/Os?


Thanks much.

bill190
01-27-2012, 06:13 PM
As for learning about PIC microcontrollers, I would advise you to not take the "easy" way out (preprogrammed and Basic).

Rather read the data sheets and learn how the internals work. Learn about interrupts. Write a C program with a bit of "inline assembly code" as an interrupt handler. Write an assembly program.

And learn how to load your programs into a PIC microcontroller with a PICKit 3. (Gets the job done for a reasonable price and you can use it for on chip "live" debugging.)

Note: I have 3 computers in my office. On "my" computer, I have a PICKit 3 connected and that connected to a PIC chip.

And on my old "visitor" computer, I have a Basic Stamp connected to "blinky LED's". If I want to show a friend/visitor the basics of programming, that is my microcontroller of choice. I also use it to test some outputs of PIC chips and the Propeller. For some things a multimeter or scope does not cut it!

Learning all about PIC chips will help you see the limitations of these chips and to appreciate the speed and multitasking ability of the Propeller.

PIC's can only do one thing at a time. So while it is doing one thing, it may not "see" a button press.

And with assembly, it can go so fast, that new unique problems crop up. For example an input line which was "high" and is transitioning to "low" may not make that transition fast enough by the time the next instruction is called. The next instruction still sees that input line as being "high"!

All sorts of challenging problems which will drive you nuts! (I call that FUN!)

Note the following development board is cheap, but gets the job done (other number pin boards available)...
http://www.sparkfun.com/products/18

Then once you select a certain number of pins board, the next step is finding and ordering a chip which will fit into that socket (another challenge).

Which Pin Count?
18, 20, 28, 40, 44, 64, 80, 100 Pins.

Which package?
28/QFN
28/SOIC
300mil
28/SPDIP
28/SSOP
208mil
28/UQFN

Order PIC chips here...
http://www.microchipdirect.com

And info/technical documents/downloads on those chips here...
http://www.microchip.com

MPLAB IDE here...
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en019469&part=SW007002

Read about MPLAB "X" as opposed to MPLAB IDE v8.83 here...
http://www.microchip.com/forums/default.aspx

Heater.
01-27-2012, 06:24 PM
Lack of development room could also be not enough memory or not enough speed. Perhaps it's the complexity of trying to perform more than one task at a time.

Steve2381
01-27-2012, 06:39 PM
Again, attempting to understand...sorry for being thick.

Is the limit mentioned above and the comment about "running out of development room" related to the number of I/Os?


Thanks much.

Both. Running out pins (that can usually be got over) and running out of programming room too.

I will still use Stamps, but want to try other options.
Anyway, my biggest gripe is they are far too expensive for most projects

As for PicAxe vs PIC... I am not that fussed. Yes, its great to learn these things the hard way, but I only want them for quick little projects.
I am buried in the Propeller stuff at the moment, so the PicAxe angle is attractive for the simple stuff.

As for speed etc. They are going to be used for seriously dull tasks, so I don't think its a problem.

Why are the Stamp chips still so expensive compared to the Prop chips? Surely component costs have come down by now.

John A. Zoidberg
01-28-2012, 02:27 PM
I started PIC microcontrollers 4 years back - and started with the PIC16F (bought the PICKit 2 and the mini board by Microchip) first. With pure assembly. Not really a good experience (bank switching is pretty nasty in ASM), but it's pretty fun and rewarding for the first time I got the LEDs to blink at a different rate and stuff.

Books to recommend:

PIC16F - Owen Bishop's "Robot Builder's Cookbook" (in ASM)
PIC18F - Mazidi's "PIC Microcontroller and Embedded Systems: Using Assembly and C for PIC18"
PIC24 - Lucio di Jasio's "Programming 16-Bit PIC Microcontrollers in C: Learning to Fly the PIC24"
PIC32 - Lucio di Jasio's "Programming 32-bit Microcontrollers in C: Exploring the PIC32"

Programmers:

PICKit 2
PICKit 3

Compilers:

Use the ones which have the lite version if you are trying the compiler or as a hobby use (all of them are C compilers).
PIC16F - CCS Compiler, HitechC (lite version available), MikroC (4kb program size limit)
PIC18F - CCS Compiler, HitechC (lite version available), MikroC (4kb program size limit), MPLAB C18 (student version available)
PIC24/dsPIC - CCS Compiler, HitechC (lite version available), MikroC (6kb program size limit), MPLAB C30 (student version available)
PIC32 - MPLAB C32 (student version available)

Microcontrollers to start with:

PIC16F - PIC16F628 (avoid the PIC16F84 as it's obsolete and expensive!), PIC16F690, PIC16F684, PIC16F887
PIC18F - PIC18F1320, PIC18F4550, PIC18F45K20, PIC18F14K50, PIC18F2550

* As for now I do not remember what should I recommend for the higher end PIC chips here, so I list down the basic ones first.

Leon
01-28-2012, 02:40 PM
Avoid the 16F628 and use the much better 16F88.

Mike2545
01-28-2012, 03:07 PM
I started with Basic Stamp, and I too would run out of headroom in a hurry. Switching to PIC's for those monster programs is a real lifesaver. I started with the 18F series on a recomendation. I got the Pic Basic Pro, which uses the stamp syntax.

For a quick and easy program I will still use a stamp to hash out the details :)

MikeK
01-28-2012, 05:46 PM
I second the recommendation of the 16F88. If you want an 8-pin, try the 12F683. I've programmed them in assembler and Basic.