C/C++ Programmable Microcontrollers

Discussion in 'Embedded Systems and Microcontrollers' started by TheRoman, Sep 7, 2010.

  1. TheRoman

    Thread Starter New Member

    Jul 22, 2010
    14
    0
    Hi,

    I've just read the 'similar threads' link, but i didnt really find my answer.

    Basically when i search for microcontrollers the majority never state if the can be programmed in C or C++, which are the two languages I would like to use. I just want some cheap microntrollers to play around and experiment with.

    How do you know if a microcontroller is C/C++ programmable would it state it in the datasheet?

    Can anyone recommend any microcontrollers?

    Thanks you in advance for your time.

    March
     
  2. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    A MCU will always be programmed in machine code. However you can use a C compiler to translate your instructions into machine code. This machine code is then loaded into the MCU. Your worry is if your C compiler do support your chip or not. Some MCU may have an architecture that is more optimized for a C compilers. Like Microchip 18fxxx series(this is compared to the Microchip midrange devices). You will not find many C++ compilers for MCUs. For MCUs memory is at a premium. Though correctness is valued and C++ helps with correctness, if it doesn't fit, it doesn't work. Even C can produce bloated code, but there's less waste when you try to reduce memory consumption by sharing as much as you can. You have forget about protection, object orientation, etc. Do it right the manual way, and make it small. The complexity of the stack possible on a MCUs does not jive with the way C++ destroys objects to reclaim memory. Even some C features like a pointer to a function don't jive with a MCU capabilities, although the complier will still let you do it it may be inefficient.
    What you need to get started is some cheap programmer and a MCU that is supported by that programmer. Both Atmel and Microchip have such programmers. I think Microchip have the best value for money solution (Pickit 2 or 3). Stay away from DIY RS232 based programmers, or any RS232 based programmers for that matter. Get a USB based one.
     
  3. TheRoman

    Thread Starter New Member

    Jul 22, 2010
    14
    0
    Thanks for your help. I have found a Pickit 2 which i think will be a good starting point :)
     
  4. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    Yes. PicKits are a very good starting point for anyone.

    They allow for a wide range of chips to be supported and help with debug operations.

    They just make life that much easier when learning to program and use uCs.
     
  5. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en027813
    Here is the list of MCUs that is supported by Pickit 2. In order to debug you have to select a PIC MCU that is listed below MPLAB 8.50 and do not require a "ICD header" This will limit the range somewhat for the pic16f series. But you will find many popular chips on the list. For the newer 18f series the list is quite big. If your budget allow it I would perhaps go for the Pickit 3 debug express bundle.
    http://www.microchip.com/stellent/i...deId=1406&dDocName=en538340&redirects=pickit3
    Also try to avoid using 16f84a in your designs. You can get, but the 16F84 is now Really obsolete. The newer ones come with many extra functions cost less and can run at higher clock speed. Many also have an internal osc. That a big plus for the beginner
     
    PRS likes this.
  6. PRS

    Well-Known Member

    Aug 24, 2008
    989
    35
    Thanks, 26afree. I followed your link and downloaded PicKit 3. It will give me something to do over the winter.
     
Loading...