• AVR Freaks

Where to start? :/

Author
jeremywilms
New Member
  • Total Posts : 4
  • Reward points : 0
  • Joined: 2010/01/31 21:33:47
  • Location: 0
  • Status: offline
2010/01/31 22:00:40 (permalink)
0

Where to start? :/

I haven't gotten too deep into electronics but I have a lot of experience programming in C, and C++, with a bit of Intel x86 assembly. I'm aware I can purchase what is known as an 'augmented micro-controller', however, I am more interested in purchasing a micro-controller such as the PIC, and building onto it as I become more experienced.

I'm looking for tools I'd need to start. I.e which programmer(I've come across a million). And what's a device adapter for?

So far I know I'm going to purchase a PIC(Do any of you have any recommendations for a beginner), a PIC Programmer(Which one?), a breadboard + some basic electronics parts(Can any of you direct me to a commonly used list of parts? I.e commonly used resistors and capacitors).


Thank you.
#1

12 Replies Related Threads

    400_up
    Super Member
    • Total Posts : 776
    • Reward points : 0
    • Joined: 2004/04/21 09:19:15
    • Location: Texas,USA
    • Status: offline
    RE: Where to start? :/ 2010/02/01 08:32:06 (permalink)
    0
    Which PIC you should start with depends on what you are planning to do. Have you got a design in mind, or are you just looking to learn PIC's?
     
    If you have a design in mind, tell us about it and we can help you choose a PIC.
     
    If you are just wanting to learn the PIC's, I suggest you use a device from the PIC18F family. If you think you might want to do some USB stuff go with an PIC18F4550, if you want a lot of I/O pins and a lot of memory go with the PIC18F6723 (or one from that sub family). You might also consider the packages available for each device, the 18F4550 comes in several packages, the 18F6723 is available in only one package. If you are going to be hand building your boards this will be very important. Or if you want a DSP go with the dsPIC device. The PIC16's and PIC18's are 8 bit devices the PIC24's are 16 bit devices and the PIC32's are 32 bit devices. Microchip has C compilers available for all but the PIC16's.
     
    For a programmer/debugger, if you can afford one get an ICD3, or a cheaper PICkit 3. Make sure the device you want to program is supported by the debugger. Many smaller footprint parts require an adapter to communicate with the debugger. Sometimes finding this information can be difficult so before you buy anything, if you have questions, ask them here. Many of us have been down this road before. You could also buy just a programmer like the PIC Start Plus, but it doesn't have any debugging capabilities. With the ICD3 or PICkit you can program and debug your firmware with the same device. You can build your development board to work with the debugger.
     
    You will need a collection of resistors, capacitors, if you want to run the PIC's at full speed you will need some external crystals. Be careful of a solderless breadboard at high clock speeds. They will work but you need to add extra decoupling to the Vdd supply. I actually built my own 5V regulator on my breadboard after having some really weird problems with a design on a breadboard. Resistor values in the range of a few hundred ohms to several thousand K ohms, DigiKey and other suppliers have some kits available. You will need some really small caps for an external crystal in the 20picoF range and some in the 10's - 30's microF range for decoupling powersupplies, and some in the .01 -.1 microF range for decoupling close to the PIC.
     

    Robert Cauthon
    #2
    Ian.M
    Super Member
    • Total Posts : 13225
    • Reward points : 0
    • Joined: 2009/07/23 07:02:40
    • Location: UK
    • Status: offline
    RE: Where to start? :/ 2010/02/01 11:42:46 (permalink)
    0
    A small correction:
    ORIGINAL: 400_up
    ...
    The  PIC10's, PIC12's, PIC16's and PIC18's are 8 bit devices, the PIC24's are 16 bit devices and the PIC32's are 32 bit devices. Microchip has C compilers available for all but the PIC10's, PIC12's and PIC16's.
    ...

    The older PIC10's (PIC10F2xx) and MOST PIC12's and a couple of legacy PIC16's (PIC16C5x) have the 12-bit core.  (8 bit data, 12 bit wide program memory) and have a very limited instruction set and only two levels of call stack and no data stack.

    Some newer PIC10's (PIC10F3xx), PIC12's and most PIC16's have the 14-bit core.  (8 bit data, 14 bit wide program memory) and have 8 levels of call stack and no data stack.

    Some new PIC16's (PIC16F1xxx) and now some PIC12's (PIC12F1xxx) have the enhanced 14 bit core (8 bit data, 14 bit wide program memory) with an increased instruction set and a 16 level call stack. 

    The enhanced midrange devices and PIC18's upwards can manipulate their call stack and do auto inc/dec on their FSR pointers allowing software data stacks.

    Microchip has bought HiTech so now has C compilers available for the PIC10/12/16 range.  The new Microchip XC 8 compiler is based on the HiTech PIC10/12/16 and PIC18 compilers.

    As you are an electronics novice, I STRONGLY recommend  starting off with DIL parts that can be plugged in a breadboard.  (package types PDIP, SPDIP and PDIP 600mil)  The largest part available in DIL has 40 pins. Everything else is surface mount and requires either a full development board or special tools to work with.
    (At the minimum a custom made PCB, a fine tipped temperature controlled soldering iron, a good illuminated bench magnifier and an EXTREME level of soldering skill, and at the high end, a full PCB prototyping system, a reflow oven, a hot air rework station with manual vacuum pick and place for part handling, and a binocular microscope.)

    The PIC18 chips are far more capable than the PIC16 chips and in many respects less frustrating to program but they tend to have al lot more and more complex built in peripherals.

    Your C experience will NOT translate well from a desktop or mainframe environment to small microcontrollers.  Although the basic language is the same, all the library functions you are used to will be either totally missing, cut down or radically different. Also due to the many restrictions of the PIC16/18 design, memory is severely limited and dynamic allocation is a really bad idea in at least 99% of all cases.  The stack limitations in particular means that parameter passing and local variables are seriously restricted and don’t use the usual method of allocating space from the stack.  Unless you have a reasonably good idea of the assembly code your C will compile to, you can use up most of your chip's resources and get in serious trouble with one badly chosen line of 'C'

    Although it is possible to program in C++ on a PIC, the limitations are such that you will have to virtually unlearn the language and start over. It offers little advantage if any over ‘C’ that is the de-facto standard for programming embedded medium performance microcontrollers.

    In my opinion you need to start by learning the basics of the Midrange architecture (PIC16 14 bit core) and then upgrade to the PIC18 series and C.

    Regarding programming/debugging:


    All modern PICS can be (and usually are) programmed via a 5 or 6 wire ICSP connection. (Supply, ground, program data, program clock, /MCLR|Vpp and optionally LVP (labelled PGM on pin diagrams).  All modern programmers equipped with a socket use these signals and route them to the appropriate pins of the PIC.)#

    Nearly all PIC18's and a few PIC16's have in circuit debug support built into them but for ALL PIC10's, PIC12's and most midrange PIC16's if you want to do debugging you need a -ICD or -ICE variant of the chip which has more pins for the ICSP/ICD interface and is only available on an expensive debug header.

    The PICkit 3 mentioned above is Microchip's latest entry level programmer/debugger but it is giving a lot of people a lot of trouble. Hopefully the problems will be resolved soon, but a year now nearly four years down the line it still isn't 100% 'right'.  It is the only entry level choice that supports debugging PIC32 series from MPLAB. Edit: The PICkit 3 situation is much improved as it can now emulate a PICkit 2 with the standalone programming application and now has a debug capable starter kit .  Many users here would still recommend its predecessor the PICkit 2.   Warning: the 'Pickit 2 Starter Kit' includes the 'Low pin count demo board' which does not support debugging unless you buy an expensive debug header and adaptor board (except using a  PIC18F14K22 - which is from a different family of PICs and is not included with the kit and the pins required by the debugger conflict with the pot and switch)

    The minimum recommended 'kit' to get into PIC programming is a selection of debug capable DIL PICs, a solderless breadboard and a selection of components etc.,  a regulated, current limited 5 V PSU (optionally: one capable of providing 3.3 V for low voltage PICs and +/- 12 V for analog interface circuits) and a PICkit 2 (part# PG164120) + either a home made 6 x 0.1" pitch pin header to individual pins cable to connect the PICkit 2 to your PIC on the breadboard or order  AC162069 - MPLAB ICD 2 Breadboard Cable and AC164110 - RJ-11 to ICSP Adapter (which also gives you a ICD 2/3 type RJ-11 connection from your PICKIT 2)  N.B. you cant currently debug enhanced midrange parts (PIC12F1xxx or PIC16F1xxx) with a PICkit 2.

    If you have a bit of cash to splash, get the PICDEM Lab Development Kit (DM163035) which has nearly everything you need to get started with baseline and mid-range PICs.  It includes a PICkit 2* plus all the parts, software and equipment you need to get started except for a Windows PC (32 bit XP recommended, 98SE, 2000,  Vista and Win7 are possible), a 9 V DC 'wall wart' PSU and a digital multimeter.  Although the kit  is not intended for anything over 20 pins, the solderless breadboard area is generous enough to allow you to venture into using 28 pin parts and selected DIL PIC18's.  One debug capable PIC is supplied, a PIC16F88 (which I personally recommend as an entry level PIC as all reasonably well written programs in books and tutorials for the PIC16F84(a) can be ported to it simply by changing the included chip specific header file, the first address used for user ram and initialising two extra registers to turn off its advanced analog features)

    * Currently the PICDEM Lab kit includes a PICkit 3. If you want a PICkit 2, you may still find a supplier with old stock - just ask them if the programmer pod is black (PICkit 2) or  red (PICkit 3)
     
    Another alternative is the Gooligum development board which targets the smaller PICs (up to 14 pins) and compliments the popular Gooligum tutorials.  It does not support any PIC with built in debuging.


    Edit: Updates + spelling corrections (Nov 2010).   Small updates (Nov 2011).  Updated device family and PICkit 3 info. Added Gooligum board. (current)
    post edited by Ian.M - 2012/10/29 16:14:14
    #3
    rmteo
    Super Member
    • Total Posts : 1007
    • Reward points : 0
    • Joined: 2007/05/02 20:33:25
    • Location: Colorado, USA
    • Status: offline
    RE: Where to start? :/ 2010/02/01 12:23:10 (permalink)
    0
    Here is a huge selection for you to pic from http://www.mikroe.com/en/tools/

    #4
    Ian.M
    Super Member
    • Total Posts : 13225
    • Reward points : 0
    • Joined: 2009/07/23 07:02:40
    • Location: UK
    • Status: offline
    RE: Where to start? :/ 2010/02/01 14:42:34 (permalink)
    0
    Nice stuff but not cheap and rather propritory.  Check compatibility with MPLAB, Microchip development tools, libraries etc. CAREFULLY, BEFORE buying to make sure you aren't locked into a system that cant be used with Microchip's free software.
    #5
    Stefan Uhlemayr
    Super Member
    • Total Posts : 4292
    • Reward points : 0
    • Joined: 2005/05/12 12:25:46
    • Location: Germany
    • Status: offline
    RE: Where to start? :/ 2010/02/01 15:12:45 (permalink)
    0
    @Robert and Ian: Nice work, and a good guideline for the first steps with a PIC! Smile I'll add it to Dale's guideline into the hw-gallery:
    ORIGINAL: Flying with HardWare Favorites Gallery List

    -------------------------------------------------------------------
    [ General Circuit-Design-Questions:                               ]
    -------------------------------------------------------------------


    How should I start with PIC's: from Dale Chisholm

    Greetings,
    Stefan
    #6
    400_up
    Super Member
    • Total Posts : 776
    • Reward points : 0
    • Joined: 2004/04/21 09:19:15
    • Location: Texas,USA
    • Status: offline
    RE: Where to start? :/ 2010/02/01 16:04:15 (permalink)
    0
    Thanks Stefan, I should have provided a link to Dale's post in the first place. In fact Dale's post should be a part of the FAQ section.

    Robert Cauthon
    #7
    Stefan Uhlemayr
    Super Member
    • Total Posts : 4292
    • Reward points : 0
    • Joined: 2005/05/12 12:25:46
    • Location: Germany
    • Status: offline
    RE: Where to start? :/ 2010/02/01 16:16:49 (permalink)
    0
    ORIGINAL: 400_up

    Thanks Stefan, I should have provided a link to Dale's post in the first place. In fact Dale's post should be a part of the FAQ section.

    Yes, Dale's reference-style post's here are really worth reading. Smile And some of them are (indirectly) part of the FAQ-section, as the hw-gallery is posted as FAQ here.wink

    Greetings,
    Stefan
    #8
    jeremywilms
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2010/01/31 21:33:47
    • Location: 0
    • Status: offline
    RE: Where to start? :/ 2010/02/01 17:32:12 (permalink)
    0
    Thank you for you great replies everyone.
     
    I'm finding the PICDEM Lab Development Kit  quite attractive, and am considering purchasing it. I think I'm gonig to be working with ASM, although I haven't researched the instruction set used.
     
    Is there anything else I would need after purchasing the PICDEM Lab Dev Kit?, I.e a powersupply?
     
    Thank you very much.
    #9
    jeremywilms
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2010/01/31 21:33:47
    • Location: 0
    • Status: offline
    RE: Where to start? :/ 2010/02/01 18:09:36 (permalink)
    0
    Thank you for you detailed replies, it is well appreciated.

    I'm thinking of purchasing a PICDEM Lab Development Kit, as it seems to be the easier choice. Although, I do already have a wall wart, and I'm currently running windows server 2003, but I can setup a VM for XP if required. Is there anything else I'd need to purchase, I.e a power supply, or some connector cable?

    Thanks.
    #10
    Ian.M
    Super Member
    • Total Posts : 13225
    • Reward points : 0
    • Joined: 2009/07/23 07:02:40
    • Location: UK
    • Status: offline
    RE: Where to start? :/ 2010/02/01 20:28:05 (permalink)
    0
    There is a nice Hires photo of the PICDEM LAB [HERE]  which will give you a much better idea  of what you are getting.

    The PICkit 2 comes with its own USB cable.  The board plugs directly into the PICkit 2, just use the correct connector along the back edge for the size PIC you are using.  It is complete apart from a 'wallwart' PSU, though if I were you I'd put a couple of spare PDIP PIC16F88 chips on the order so you aren't stuck if you blow the debug capable chip. You may want to also buy some miniature tactile switches like the ones on the other Pickit 2 demo boards from a local supplier so you can try out the low pin count examples and tutorials by copying the circuit in the breadboard.

    If your wallwart outputs between 9 and 12 V DC it should be fine. The schematic shows a reverse polarity protection diode on the external power input so just plug it in with S1 the onboard power switch OFF and check there is the correct positive voltage at J2, next to the power connector before proceeding further. The schematic shows it as centre +ve but please confirm that before switching on.

    I suspect it will probably work fine with Windows server 2003, but if not AS LONG AS YOU CAN SET UP AN XP VM with USB port support it will be fine. A fellow SourceBoost user has done that under Windows 7 using 'Windows Virtual PC' (not 'Virtual PC 2007' as that has no USB support) [HERE] so you would need a third-party VM solution (e.g. VMware - even the player) with USB support.   I know of MAC owners successfully running MPLAB with a PICkit 2 under VMWare Fusion.

    If you are programming a PIC that isn't directly supported by the PICDEM Lab Development Kit, just plug the programmer onto the connector for the 18 pin socket and WITH NO PIC IN THAT SOCKET jumper from the connectors of the Vdd (+V, pin 14), Vss (0V, pin 5) /MCLR (pin 4), ICSPDAT/PGD (pin 13) and ICSPCLK/PGC (pin 14) to the equivalent pins of the PIC on the breadboard.  Make sure any pin labelled PGM is grounded to Vss as must be all Vss/AVss pins of the chip and all Vdd/Avdd pins MUST be powered.  Add 0.1 uF caps across each pair of Vdd/Vss pins or AVdd/AVss pins.  Select the correct PIC and voltage in the software before connecting the programmer. If using external power set Vdd to the correct voltage by adjusting R1 then switch off S1 BEFORE inserting the chip although the PICkit 2 is easily capable of powering most chips while programming.  Try to avoid connecting anything else to the three ICSP signals in your application circuit as that can prevent successful programming and/or debugging.  The 'Using PICkit 3 poster' is 99% applicable to the PICkit 2 (Wherever it says PICkit, just read '2' instead of '3'!) and is an excellent quick reference for setting up for successful programming and debugging.

    N.B. There is a fault in the board design for the serial analyser header.  If using this connector you MUST make the modification documented in the PICDEM Lab errata.

    Edited to update links, fix spelling and add a little more about debugging.  (Nov 2010) More broken links (current)

    post edited by Ian.M - 2011/11/28 21:07:41
    #11
    jeremywilms
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2010/01/31 21:33:47
    • Location: 0
    • Status: offline
    RE: Where to start? :/ 2010/02/02 21:53:00 (permalink)
    0
    Alright, thanks guys.

    I've written lots of kernel code before, which required me to work with C, w\o the standard libraries where I had to interfacing with hardware. Although, as comfortable as I may feel with C, I think ASM is the way to go. The instruction set seems fairly easy to learn, and I like the feeling of more control when I'm working with a more delicate device.

    As for purchasing electronic components, Digi-Key forces me to buy in ridiculously large amounts of simple components. I live in Canada, BC, are there any convenient places which sell them in my area? Or other online store?
    post edited by jeremywilms - 2010/02/02 21:57:57
    #12
    WaltR
    Super Member
    • Total Posts : 3759
    • Reward points : 0
    • Joined: 2003/11/07 12:38:21
    • Status: offline
    RE: Where to start? :/ 2010/02/03 10:52:23 (permalink)
    0
    Everyone's suggestions above are good but here's my take on starting out.

    Don't buy anything for a few months.
    Download and install MPLAB.

    Go to the Gooligum tutorials and do the lessons using MPLAB and the built in simulator. Download the data sheets for the PICs used and get to understand what each line of code does and why.

    Now down load a few data sheets, I suggest the 16F84 as it only has a few peripherals so it is not as confusing to start. Write and simulate code for this PIC. When you know how to use all the capability of the 16F84 go the the 16F87 (more peripherals) and learn these.

    By now you'll have a good understanding of what PICs can do. If you are still interested then buy the PICDEM LAB to run code on real hardware.

    My feeling is that by learning to use MPLAB and writing code first will eliminate much of the frustration I've seen in beginners posts where they want to have the PIC running but fail to learn the basics first.

    Good luck and have fun learning PICs
    #13
    Jump to:
    © 2019 APG vNext Commercial Version 4.5