Maker Pro
Maker Pro

programming language to program hardware

gongpex

Jun 4, 2011
11
Joined
Jun 4, 2011
Messages
11
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
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
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:

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
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.
 

newera

Dec 4, 2011
3
Joined
Dec 4, 2011
Messages
3
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.
 

MattyMatt

Mar 24, 2011
161
Joined
Mar 24, 2011
Messages
161
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-
 

GonzoEngineer

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

Just sayin......
 

jackorocko

Apr 4, 2010
1,284
Joined
Apr 4, 2010
Messages
1,284
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.
 

GonzoEngineer

Dec 2, 2011
321
Joined
Dec 2, 2011
Messages
321
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.

Good point!:D
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
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.
 

MIBO

Jan 3, 2012
2
Joined
Jan 3, 2012
Messages
2
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.
 
Top