Microcontrollers?

Posts 1–15 of 16 · Page 1 of 2
Microcontrollers?
I want to get into programming for microcontrollers, so what's the best way to do this? Buy a microcontroller breadboard beginner kit type thing? Also, do any of them come with C++ compilers, or will the only thing available be C and Assembly? I've looked at a few beginner kits, but was hoping somebody with some experience in the area could tell me what's what before I jump out and waste my money.
Only C and Assembly ...

Ps. I would go for C, it's easier to learn.
@HeXel I have no problem with C or C++, I've read several books and written several programs with both. I prefer C++ though, as I find OOP a shit ton simpler with it.

Edit: the assembly is what I'd really like to learn about.
Is microcontroller assembly similar to x64 assembly?
Quote Originally Posted by t7ancients View Post
Is microcontroller assembly similar to x64 assembly?
Same nope. similar, yes.
It could be vastly different depending on the microcontroller you buy. There are many manufacturers, each with their own instruction set.
Quote Originally Posted by Fovea View Post
It could be vastly different depending on the microcontroller you buy. There are many manufacturers, each with their own instruction set.
True indeed. (but the "logic" of it will still the same)
A lot of instructions will be similar as well, right?
Honestly, the first thing you should worry about is finding a microcontroller. The next step is to just read the microcontroller's instruction set manual.

On a side note, why you're bothering with assembly is beyond me.
Well, assembly helps with understanding how it works on a lower level than C/C++ would, right? Aren't assembly programs smaller and normally faster than C programs? Also, aren't there things you can do in assembly that wouldn't be possible with C or C++? I dunno, I'd just enjoy learning about it. It's be nice to know if I had make small and fast code, which would be good for the limited processor and memory of a microcontroller, right?
Quote Originally Posted by t7ancients View Post
Well, assembly helps with understanding how it works on a lower level than C/C++ would, right? Aren't assembly programs smaller and normally faster than C programs?
Yes that's true, take a look at this ancient picture.



However a program coded in assembly takes a lot of time to develop

An average sized project in mfc may take 3-6 months.
The same in c+win32 api maybe 18 months.
hand coded assembler probably 3 years.
Once again, this no longer holds true. Also if you're proficient in assembly it will only take you slightly longer to code than in C. If it takes you three years, I suggest you find another hobby.

Fabricated statistics are always great.
Quote Originally Posted by Fovea View Post
Once again, this no longer holds true. Also if you're proficient in assembly it will only take you slightly longer to code than in C. If it takes you three years, I suggest you find another hobby.

Fabricated statistics are always great.
I'm not talking about small projects. In the professional world time is money.

This "slightly" would cost a lot of cash to a company.
That may have been the truth of yesteryear, but the truth about assembly in this day and age is that compilers are far better at optimizing than any assembly lackey. To optimize code for speed you need to know many things about the processor itself, and different processors have different quirks. Some cases may even seem counterproductive such as loop unrolling (a loop is unrolled by repeating the body of the loop so that there is no branching instruction). In the long run its not worth it, and speed is not your first concern (see premature optimization). Speed and size is usually not a problem because our processors are so powerful these days and we have plenty of memory to spare. Also keep in mind you can optimize for speed or size, otherwise there will be a tradeoff (great example is loop unrolling which favors speed over size).

Use assembly only when you really need it. Otherwise stick with higher level languages.
Posts 1–15 of 16 · Page 1 of 2

Post a Reply

Tags for this Thread

None

Talk with us