We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,089 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Hardware programming with C/C++

I spent about an hour or so googling but no luck.
I want to program for hardware(which apparently people seem to think is obsolete for some reason) however i can find no tutorials on it period i suppose i could always use Assembly but my knowledge isn't that great. Is there anywhere i can learn( besides college or anything that requires $$$ since im always broke) hardware programming(firmware or manipulation or just even interaction) with the std library. I really don't want to use anything thats not in the standard library.

3
Contributors
2
Replies
2 Years
Discussion Span
9 Months Ago
Last Updated
7
Views
avarionist
Junior Poster in Training
70 posts since May 2010
Reputation Points: 11
Solved Threads: 3
Skill Endorsements: 0

Well, as a robotics engineer, I can tell you that hardware programming is far from obsolete. It is in fact probably the most important and time-consuming task when dealing with robots and other similar stuff.

One thing that is important with hardware programming is what you are programming on. If it is a standard PC and your hardware is via USB, RS232, FireWire, etc. than you will have to resort to OS-specific libraries (but mainly standard parts of the operating system libraries) and this is really like regular programming but often these OS APIs are based on C, but very easily wrappable in a C++ environment (the so-called hardware interface layer of your program).

If you're dealing with a embedded PC or microcontroller (which simple robots, mobile phones and other small stuff use), then you have to check if it is powerful enough to run an operating system like FreeRTOS or micro-Linux (or embedded windows if you are of that painful OS flavour). Then there is a whole bunch you need to look at for so-called "cross-compiling" in order to write, compile and test your programs on a PC. There are editors tailored for that, like AVR-Studio and Arduino, most of which allows you to program in C++, but the standard libraries (std namespace) require that you have the appropriate libraries for the system you use. Often micro-controllers offer only C run-time libraries, but if you can run an operating system than it usually comes with all the std libs, but you have to set up the environment for cross-compiling which I'm sure you can find tutorials on (my friend who barely knew programming could set it up after a few weeks of trying).

Another friend of mine even programmed a robotics system running on cheap micro-controller running FreeRTOS and using C# to program it (so if it is possible to use C#, it's definitely possible to use C++).

All in all, when dealing with hardware it's always a lot very low-level stuff so don't expect many ready-made easy solutions. It's always a lot of reading through your micro-controller, embedded-PC, DAQ card, etc. spec-sheets and getting to know what bit-sequences to use, bit-parity, checksums, shift registers, etc. etc.

mike_2000_17
21st Century Viking
Moderator
3,136 posts since Jul 2010
Reputation Points: 2,050
Solved Threads: 625
Skill Endorsements: 41

Well, as a robotics engineer, I can tell you that hardware programming is far from obsolete. It is in fact probably the most important and time-consuming task when dealing with robots and other similar stuff.

One thing that is important with hardware programming is what you are programming on. If it is a standard PC and your hardware is via USB, RS232, FireWire, etc. than you will have to resort to OS-specific libraries (but mainly standard parts of the operating system libraries) and this is really like regular programming but often these OS APIs are based on C, but very easily wrappable in a C++ environment (the so-called hardware interface layer of your program).

If you're dealing with a embedded PC or microcontroller (which simple robots, mobile phones and other small stuff use), then you have to check if it is powerful enough to run an operating system like FreeRTOS or micro-Linux (or embedded windows if you are of that painful OS flavour). Then there is a whole bunch you need to look at for so-called "cross-compiling" in order to write, compile and test your programs on a PC. There are editors tailored for that, like AVR-Studio and Arduino, most of which allows you to program in C++, but the standard libraries (std namespace) require that you have the appropriate libraries for the system you use. Often micro-controllers offer only C run-time libraries, but if you can run an operating system than it usually comes with all the std libs, but you have to set up the environment for cross-compiling which I'm sure you can find tutorials on (my friend who barely knew programming could set it up after a few weeks of trying).

Another friend of mine even programmed a robotics system running on cheap micro-controller running FreeRTOS and using C# to program it (so if it is possible to use C#, it's definitely possible to use C++).

All in all, when dealing with hardware it's always a lot very low-level stuff so don't expect many ready-made easy solutions. It's always a lot of reading through your micro-controller, embedded-PC, DAQ card, etc. spec-sheets and getting to know what bit-sequences to use, bit-parity, checksums, shift registers, etc. etc.

Thanks :D
yeah i know its far from obsolete game,phones,tv,stereos etc. have to have some interaction with the hardware lol. I know its not easy thats why i want to and i'm perfectly ok with C. So basically instead of looking for tutorials for hardware programming just look for the devices spec sheets ? like if i wanted to interact with a rj45 port(ethernet card) i would look that up? that makes sense. ive got a bunch of old hardware that doesnt really matter and was wanting to repurpose them(well tinker with user created firmware) hardware programming really interests me. i'll probably learn more of ASM then since its about as low as you can get with out writing machine code(which there are 0 tutorials guess since it would be redundant with all the languages there are to choose from).

Thanks though that helped a bunch :D

avarionist
Junior Poster in Training
70 posts since May 2010
Reputation Points: 11
Solved Threads: 3
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0834 seconds using 2.68MB