Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Which microcontroller to learn?

  1. Jul 8, 2005 #1
    As a mechanical engineering student who is interested in designing and constructing underwater ROVs and AUVs, I have found that many systems use microcontrollers. I have also found that the number of different microcontroller families and their various programming languages is, to me, confusing.
    After attempting to research the different types, I find that I am getting more confused rather than less. Basic stamps, 8051s, PICs, PICStix, Rabbits, Atoms...as you all know, I am sure, the list is near endless.
    In order to make a decision about what type of microcontroller to start with, I have decided to ask the experts here on the Physics Forum.
    Please give me some insight on where an electronics novice < I CAN breadboard and construct a circuit given a schematic> should start learning to implement and program microcontrollers.
    Thanks in advance,
  2. jcsd
  3. Jul 8, 2005 #2


    User Avatar

    Staff: Mentor

    Great question, Bill. But your footer already says that. :biggrin:

    You know, the uC of choice changes every couple of years, and is fairly dependent on what your target application is. Plus, the trend is to try to do as much coding in C as possible, since that is portable across the uC platforms, and only use platform-specific assembly code where it's absolutely needed. Also, most uCs have inexpensive eval boards with example IO circuitry on them, and that's usually a good investment for exploring the capabilities and tool chain for each uC. Having said that, here are a few thoughts:

    -- Atmel Tiny 11/12/13 -- these are very low cost uCs with minimal feature sets. But, very popular in low-function, very low cost applications. If you're interested in designing consumer key fobs, etc., it would be good to play with this family.

    -- PICs from MicroChip -- Great family with a wide range of cost/features available. This is a good family to learn and buy a tool chain for.

    -- 8051 -- Classic uC architecture, and good to learn.

    -- HC11 -- ditto.

    -- Renesas uCs -- Higher end, but lots of bang for the buck

    My best advice to you right now would be for you to decide what class of devices interests you the most (low-cost, medium-performance, or high-performance), and get a Starter Kit for a good uC that fits that category. Then play some and experiment with some demo apps to figure out where the C/Assy boundary is, and write some combined C/Assy code to do something. That will get you 80% of the way to being a productive engineer with uCs.

    For example, if you're interested in medium-performance, medium-cost uCs, and maxing out the performance/price ratio, then get a PIC uC Starter Kit, and code up some audio music synth software. The higher level control software can be in C, but the lower level interrupt-driven real-time audio routines will likely be in assembly. One of my consulting projects many years ago was shoe-horning EEG DSP plus music generation into an 8051 for a personal biofeedback machine. I had that sucker running at about 90% assembly language utilization to keep up with all the interrupts by the end of the project! -Mike-

    EDIT -- I just re-read your post, and for underwater ROVs and AUVs, you'll want medium-to-high performance uCs. So focus on the higher-end PICs and Renasas uCs in your search.
    Last edited: Jul 8, 2005
  4. Jul 10, 2005 #3
    Thanks for the reply, Mike!
    I believe that I'll go with PICs since there is so much documentation available on the Web.
    So much to learn..so little time.
    Any additional input would be welcome.
  5. Jul 10, 2005 #4
    As for me , the only uController i have ever programmed is a PIC..

    You would need a circuit called a programmer to put your program into the uC..
    On your PC you then download the various free software packages , to run with the programmer..
    the programmer connects to the PC in one of three ways..

    there are
    serial Programmers (not Recommended)
    parallel port programmers (Recomended but are being replaced by USB)
    USB programmers ( i would like one myself .lol.)

    i have sucessfully programmed a 16F628 and 16F88 ,if you decide to go this route dont use the 16F84, or the 16F84A as they are obsolete ..

    Although i havnt used a silicon labs Chip yet ..they are an incredable uC..packed with features and are an 8051 derivitive, but with a lot more features...
  6. Jul 11, 2005 #5
    O.K. USB programmer...check
    Now...since there are also roughly 25 different compilers using roughly 6 different programming languages...Anyone have some insight whether to use C, C++,C,BASCOM,PICBasic, PICBasic Pro, Java, Fortran,or just talk to it with a lilting French accent?

    Also...I see some really cool development boards available for PIC from MeLabs and others. Is there an advantage to using one of these?

    OK..that's all the newbie questions for today. Thanks in advance for the help!!!
  7. Jul 11, 2005 #6
    LoL I didnt see Assembly in that list !!
    I suppose whatever language you are comfortable with , use that..
    there are free versions of C , PIC basic, lol no fortran or lilting French accents ..
    once you write your program ( in assembly is all i can speak for) , you assemble it..Mpasm is free from microchip..it comes with the MPlab...
    the assembler creates a Hex File ( similiar to Intel Hex )
    the Programmer then takes the Hex file and puts your program in the PIC..
    dont know , never used one...
  8. Jul 12, 2005 #7
    The very typing of the word gives me chills and a vague feeling of syntax induced confusion. Are my fears unwarranted? All I have ever done is some good ol' BASIC and a semester of Visual Basic.
    Input please?
  9. Jul 12, 2005 #8
    the syntax is easy ,a typical line may or may not have a label in the leftmost column, tab over insert your opcode and operand..
    comments are designated with a ;
    the pic has a reduced instruction set so for the majority of them there are only 35 instructions to learn..
    Code (Text):

    label     opcode,operand

               movlw,d'255'   ;W is the working register almost everything must go through W
               movwf,Var1     ; loads Var1 with 255
    Loop     decfsc,Var1     ;this decrements Var1 , till it is zero, then exits loop
               goto Loop

    if your eyes are glazed over at this point , then maybe a basic compiler for the pic is right for you...
  10. Jul 12, 2005 #9


    User Avatar

    Staff: Mentor

    As I mentioned, you will generally write in a mix of C and Assembly. C for portability and readability, and Assembly where you need the extra speed or need to minimize the code footprint (fit the code into as small a memory space as possible). You won't generally use C++ for uC coding, unless you're up in the Renesas range of higher-end uCs.

    If all you've used in the past is Basic, I would strongly recommend that you take a C class or do self-study. Get a copy of "The C Programming Language" by Kernighan and Ritche, 2nd edition or higher if there's a newer one. You can use the Microsoft Visual Studio tools to compile C, or you can download a free compiler like Pacific C off the Internet for your PC. To target a uC, you'll usually need to buy a toolset specifically for that uC from the uC manufacturer or an associated 3rd party. I first learned Fortran and Pascal in college back in the late 70's, but when I got out in the real world, most everybody was writing in C. So I taught myself C with the K&R book, and it was pretty easy to pick up. Especially since I had real stuff that I needed to get done soon -- a good motivator for learning!

    And don't worry about Assembly coding. It's pretty natural and intuitive. You just have to be a bit more careful to set some rules for yourself and follow them, because the Assembler is not going to do as much error checking as a C compiler would.

    I think the demo boards are a great way to get up and running. Try to get one with some I/O features on it that will make it easier to use in some of the experiments that you have in mind.
  11. Jul 14, 2005 #10
    OK...programmer ordered...demo board ordered.... Kernighan book ordered...thank GOD for EBay!
    I am almost prepared to make that LED blink.
    Any additional input would be appreciated and I thank you all for your help.
    I'll be back with more questions... so don't get too comfortable. :)
  12. Jul 14, 2005 #11


    User Avatar

    Staff: Mentor

    Hi Bill, Sounds like you're moving right along! You should also download a free C compiler or two, so that you can start playing around writing simple programs on your PC right away when your K&R book arrives. Here's a good website to find a free C compiler:


    I like the Pacific C compiler, but it's just a klunky DOS interface. Some of the other choices at that web page might be better, especially some of the ones that go with the free GUI development packages.

    Have fun! -Mike-
  13. Jul 17, 2005 #12
    If you go to the microchip website (http://www.microchip.com), you can get free samples of PIC microcontrollers every month. They also have a max 16(I think) pin microcontroller programmer for about $25. It's great for educational purposes and small projects.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook