0
$\begingroup$

I ask this since assembly language is really close to the micro-controller hardware, and what micro-controller would you reccomend.

The bot has to search for object that I show it before and then I 'lose' the object. Note, I do not know anything about micro-controllers.

$\endgroup$
  • $\begingroup$ "What micro-controller would you recommend" is almost like "What car would you recommend", or "What tree should I plant in my garden". $\endgroup$ – Shahbaz Sep 24 '13 at 16:14
  • $\begingroup$ Learning assembly isn't generally necessary. There are situations where you would need it however. If you can describe what you would like to do then you will get more targeted and likely more helpful answers. $\endgroup$ – DaemonMaker Sep 24 '13 at 16:15
5
$\begingroup$

This is one of those "open-ended" questions that the moderator doesn't like. So I'm going to leave you with some short, general answers. These are based on over 20 years in industry designing various bits of hardware and software for embedded systems:

  • Learning enough about microprocessors so that assembly language programming comes naturally will be a big plus, but is not necessary. Just knowing assembly language programming for some processor or another because you've memorized it isn't going to be very useful.
  • There is no one microcontroller to recommend. There is such a huge number of factors that come into play that the correct processor for your project could be anything from a slow 8051 clone to a super-fast bazzilion-core desktop processor with liquid cooling.
$\endgroup$
  • 1
    $\begingroup$ To get microcontroller guidance, I'd suggest asking "what size and speed processor do I need" along with an outline of your specific project. Then go find microcontrollers that meet those criteria. $\endgroup$ – TimWescott Sep 24 '13 at 16:12
  • $\begingroup$ Certainly, this moderator is unimpressed... but is not rushing for the delete key :) $\endgroup$ – Andrew Sep 25 '13 at 20:32
6
$\begingroup$

In general you don't need to learn assembly to be able to program a microcontroller. As long as you know C, it's enough for you.

Knowledge of assembly of course would help. Specifically, it would help in writing optimized code (or rather, not writing stupid code) as well as having a good estimate of how fast or slow a piece of code could be. Sometimes in very performance critical sections manipulating the assembly may also be needed, but again, in general you wouldn't be needing any of this.

Specially if you are a beginner.


Regarding microcontrollers, there is a wide variety of them, almost all of which are good and useful. Choosing a microcontroller really depends on what you want to attach to it and how complicated its software is going to be. With similar microcontrollers among different brands, I would personally pay attention to how well the microcontroller is documented and how good its compiler/IDE is. Little-explained data-sheet is a headache and a bad IDE an annoyance you don't want to deal with.

$\endgroup$
  • 1
    $\begingroup$ Once you get past the documentation (good point!) I find that my microcontroller choice often comes down to finding a bunch of candidate chips that have the speed and memory size I need, then finding the one (regardless of brand or core) that has the peripherals and features I need -- in other words, if I need six PWM outputs, then I'll only look at microcontrollers with that set of features, etc. $\endgroup$ – TimWescott Sep 24 '13 at 16:15
  • $\begingroup$ @TimWescott, exactly. Thanks for the comment. $\endgroup$ – Shahbaz Sep 24 '13 at 16:16
3
$\begingroup$

The major disadvantage of assembly language is that it is different for each processor that you use. Therefore there is a big learning curve whenever you change processor.

Clearly, if you only ever plan on using a single processor (or family of processors) then this is less of an issue; however, life is rarely that simple.

Equally, assembler allows you to really get things wrong, unless you are very careful. I speak as someone with lots of years commercial experience writing flight-critical assembly code!!

On the other hand, pretty much every processor comes with a suitable C compiler (as @Shahbaz suggests) and porting C from one processor to another is a lot more straightforward than porting assembler.

Unless you already have good assembler experience, I'd be minded to learn C, and leave assembly language for those (very rare) occurrences when C just isn't up for it.


As for which processor... how long is your piece of string?

$\endgroup$
  • $\begingroup$ These days you almost never actually need assembly language. The reason I worded my answer the way that I did is that if you know microprocessors well enough in general you can (a) pick up the assembly for any given one quickly, and (b) understand a lot of important issues in depth that would otherwise escape you, whether or not you happened to use assembly at all, ever. $\endgroup$ – TimWescott Sep 30 '13 at 21:09
  • $\begingroup$ Fully agree with you @TimWescott $\endgroup$ – Andrew Oct 1 '13 at 10:06
0
$\begingroup$

I think the answer here is "that's the wrong question". (It's a bit like asking "what spoken language should I learn if I want to write detective novels?") But it does have an answer: it depends.

I can't speak for everyone, but when I was just starting out in programming it seemed to me that learning assembly language would help my programs run faster. This is not necessarily true, because it was based on a faulty assumption: that my writing assembly code (at a beginner level) would produce more efficient code than today's sophisticated compilers. Furthermore, I assumed that I could pull off complicated algorithms in assembly in the first place -- look at how a simple algorithm like bubble sort becomes very intimidating in assembly.

You should have a good command of the algorithms themselves that are required for robotics. With that knowledge, the specific language is irrelevant; you will use the language most appropriate to the platform, even if you have to learn a new language to do so. In some cases this will be assembly, in other cases it will be a variant of C/C++ (like in Arduino), and in still other cases it could be a high-level language.

But learn the theory first, before you get bogged down in the implementation. In other words, before you choose a language you should think about what you're going to say.

$\endgroup$
  • $\begingroup$ This bubble sort is very intimidating for 16 bis values only. And it's a good example for bad comments, like push ax ; push ax onto the stack and mov bx, cx ; set bx=cx :-). loop is an expensive instruction, you're better off with dec bx followed by jnz loop_start - and it saves you from push/pop cx. $\endgroup$ – ott-- Sep 26 '13 at 15:57
  • $\begingroup$ How is this relevant? $\endgroup$ – Ian Sep 28 '13 at 18:13
0
$\begingroup$

What kind of problems are you interested in? Mechanical design? Electronics? Low-level control and algorithms? High-level planning and state estimation?

Pick your battles. Assembly is good to know for some projects, but use bigger/easier building blocks depending on what your interest is.

$\endgroup$
  • $\begingroup$ Can you elaborate on Low-level control and algorithms and also high-level planning and state estimation please, i'm a noob $\endgroup$ – Operative Sep 27 '13 at 4:59
  • $\begingroup$ PWM drive of motors using feedback and a PID controller (unnecessary if you buy servos) -- this is low-level engineering/programming so your robot has basic motion control. Higher-level refers to the computer science / math part: given a working robot, how would you program it to run around a room avoiding obstacles? State estimation alludes to the idea that sensors are noisy and the computer will have incomplete and ambiguous information about the robot's environment, so you have to do some math to get a best estimate of what'ss really going on. $\endgroup$ – brak2718 Sep 27 '13 at 8:19
  • $\begingroup$ So the low level engineering/programming is you buying parts which aren't a functional robot, putting them together and then programming them to so that they move like one? and for that you need "PWM drive of motors using feedback and a PID controller"? $\endgroup$ – Operative Sep 27 '13 at 12:11
  • $\begingroup$ Basically, yes. Two general options are: 1. buy a working robot (electronics & mechanics already done, but the thing has no intelligence) then spend your time programming it to do interesting things, like run around your house; or 2. build a robot, in which case you will learn a lot about electronics and microcontrollers (program in assembly if you need to) and mechanics. $\endgroup$ – brak2718 Sep 27 '13 at 23:22
0
$\begingroup$

It's nice, but for the most part, unnecessary if you're just dealing with robotics. Maybe if you need some high-end optimization, it may be helpful. But most compilers can optimize better than average humans these days anyway. Unless you really know what you're doing and understand the architecture enough to optimize further, I'd say it's not necessary. Plus, different manufactures have their own instruction sets, many of which behave differently on different MCU's. Another thing to cosider is that syntax varies between different MCU's. For instance, AVR MCU's have a different syntax than MIPS architectures and TI DSP's. It all depends on what you're doing.

$\endgroup$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.