Connect with us

programming language to program hardware

Discussion in 'Microcontrollers, Programming and IoT' started by gongpex, Dec 2, 2011.

Scroll to continue with content
  1. gongpex

    gongpex

    11
    0
    Jun 4, 2011
    Hello everyone,

    I'm currently work as a programmer, and I want to learn about microcontroller,

    what programming language that people commonly used to program application like:

    robot, printer,video card and etc (computer hardware)?

    I had ever heard if C or C++ can do, Is that right?

    please answer me.

    Thank you
     
  2. Harald Kapp

    Harald Kapp Moderator Moderator

    10,025
    2,138
    Nov 17, 2011
    In my opinion, programming µCs with C++ is like cracking nuts with a sledgehammer - but possible.
    A good compromise between ease of coding and speed/size of code is C.
    Some Assembler may be required for critical sections (e.g. interrupt routines).
    Plus there are other, sometimes specialized, programming languages for µCs like Basic (thousands of variants), Sketch (for the Arduino platform) etc.

    I suggest you first decide which µC you are going to use. Second you find a suitable development environment which will depend on the µC of choice, your requirements (graphical IDE or command line based toolset) and on your preferences and knowledge of programming languages (not every programming environment supports every language).

    Please note that this is my personal opinion - others may express different opinions.

    Regards,
    Harald
     
    Last edited: Dec 2, 2011
  3. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,384
    2,771
    Jan 21, 2010
    High level languages make the programming easier, but lower level languags tend to be either/both faster and have a smaller footprint when used by a skilled programmer.

    The take-home lesson from this is that as a beginner, C is fine. When you get better, and when you find you're banging up against memory or speed limitations, assembler *may* be something to consider.
     
  4. newera

    newera

    3
    0
    Dec 4, 2011
    i suggest u to work in assembly language if u want complete understanding of working of hardware along software. otherwise C will be good and easy to handle.
     
  5. MattyMatt

    MattyMatt

    161
    0
    Mar 24, 2011
    A small bit of advise from someone that is also learning (we all are at some level :) ):

    As far as I can see to really step into things, it really does depend on your particular hardware, somethings can be done very nicely with C or another high-level programming language, I know a lot of the programmable micro-controllers use a high level language of some sort, but not all of them. Some types of hardware also have more specifics they require, so they use a specific assembly language or programming language to get things done.

    I agree with Steve on this one where assembly would probably be the best in the long run, as a lot of the micro-controllers are very limited on memory, and processing power. Assembly will also get you more acquainted with the actual hardware as newera was saying.

    Think of it this way, if you start with a high level language and work with it for a while, and really find the need or at least the want to potentially do more advanced things, start working your way down the programming ladder and get into the assembly once you feel comfortable.

    And remember... Have fun!
    Matty-
     
  6. GonzoEngineer

    GonzoEngineer

    321
    0
    Dec 2, 2011
    You are not a real Programmer unless you know how to bit-bang in realtime, assembly language!:D

    Just sayin......
     
  7. jackorocko

    jackorocko

    1,284
    1
    Apr 4, 2010
    Since you can embed asm in C, my take is start out where it is easier for you. Normally this means a high level language. From there you can learn asm when you need it, then you can easily slide to all asm in the event you have to use it.

    Everybody thinks differently, you currently work as a programmer, so for me to make that transition smoother I would stick with something familiar. Learn the hardware, how it works, etc. Then move into the lower level programming when you feel more comfortable. People learn best when they layer what they know with something new, trying to jump off the deep end and getting instructions to swim while your drowning seems foolish.
     
  8. GonzoEngineer

    GonzoEngineer

    321
    0
    Dec 2, 2011
    Good point!:D
     
  9. gongpex

    gongpex

    11
    0
    Jun 4, 2011
    Last edited: Dec 19, 2011
  10. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,384
    2,771
    Jan 21, 2010
    If you don't understand what assembly language is, stick to C because (like I said) it's the best route for a beginner.

    Once you understand the device quite well you can try your hand at assembler.
     
  11. Anish

    Anish

    46
    0
    Feb 5, 2011
    you have different assembly instructions for different class of microcontrollers. So if you are a complete beginner, stick on to C. Then try out assembly
     
  12. gongpex

    gongpex

    11
    0
    Jun 4, 2011
    Ok. Thanks for explanation
     
  13. MIBO

    MIBO

    2
    0
    Jan 3, 2012
    as a professional developer with over 25 years experience I gave up with assembler years ago except for startup code and low level code such as spill / fill handlers.
    I now program everything in C++, and have done for the last 14 years, in my experience for any reasonable sized project it helps generate more efficient code.
    The trick is to understand how the compiler generates code, and what addressing modes it can use, including the addressing ranges.
    Efficiency comes from careful design of the data structures, and here C++ helps greatly by encouraging object oriented programming. With objects you tend to find that all related data is grouped together in memory and can be accessed using short immediate offsets from a single reference pointer, this leads to much less register thrashing to generate load / store addresses which dominate the CPU load.
    most good C++ compilers are also excellent at adjusting base pointers to maximize the useful address range, something that's tedious to do in assembler, and the code is much more portable and maintainable.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-