Connect with us

Choosing a uC

Discussion in 'Microcontrollers, Programming and IoT' started by Xenobius, Jan 8, 2013.

Scroll to continue with content
  1. Xenobius

    Xenobius

    125
    0
    May 15, 2012
    Hello all,

    Ok so I have a project, I am not in a hurry to learn and the main purpose here is to learn. But I need to learn the right way. Basically my question is this...

    1. What is the difference from an Atmel 8 bit uC to an Atmel 32 bit uC from the Programmers Perspective?
    2. As in, what is the difference between a 'hello world for 8bit' and 'hello world for 32bit'?
    3. What is the difference for a complex system written for 8bit and the same complex system written for 32bit?

    I chose Atmel because this is what I have available and I don't really want to change. Also to save you time, do not explain stuff like, GPIOs, Frequencies, ADC, etc.. etc.. this is all in the datasheet :rolleyes:

    Thanks all!
     
  2. Xenobius

    Xenobius

    125
    0
    May 15, 2012
    Oh come on :) Someone must know! I just need a brief answer because I cannot find a damn good example to make me decide...

    Am I right to say that the code is identical ?
    Because so far this is what I noticed.
     
  3. (*steve*)

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

    25,411
    2,779
    Jan 21, 2010
    The code you write may be identical (or differing in only minor ways), but when compiled it is going to be very different.

    So "from the programmers perspective" is a very nebulous concept. If I'm programming at a low level, they may look quite different. At a high level, as a neophyte, they may appear indistinguishable, but with more skill, you will realise that there are significant differences.

    A 32 bit machine can handle more memory and wider data faster and more efficiently.
     
  4. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,270
    Nov 28, 2011
    No, the code isn't identical at all. The source code for a program in a compiled language is probably the same. Is that what you mean?

    I assume you're comparing an 8-bit AVR to a 32-bit ARM?

    The major differences are that in an 8-bit device, all the resources are very limited. Typically there's only a few hundred bytes of RAM, a few kilobytes of code space, and the registers are only 8 bits wide. This means that if you're working with large numbers, your code has to call a function just to add two numbers together. (This will be hidden by the compiler, if you're using a compiled language.)

    8-bit devices usually don't have division instructions built into the core. Many don't even have multiplication built in either. And if you want support for floating point, it's all done by subroutines as well, so you'll need to link in a few kilobytes of libraries and allow hundreds of instruction times for a simple arithmetic operation.


    And 8-bit cores are not optimised for high speed. They don't have an instruction cache, branch prediction, any of that stuff.

    I'm not familiar with the ARM, but it's a 32-bit device so arithmetic on 32-bit quantities will be quick. It may have floating point support built in; I don't know. It will probably have an instruction cache and will run a lot faster than a typical 8-bit core, and draw significantly more current.

    If it has on-board RAM and ROM, these will be much larger than on an 8-bit device. But it may require external memory. There may be variants with, and without, internal memory of various types. The internal peripherals are much more complicated and powerful on a larger device.

    That's a summary of some major differences. Which one you use depends on the requirements of your system. If you want to make a controller for a washing machine, an 8-bit device is perfect. If you want to run Linux, you need a bigger, faster processor like an ARM or an x86 (as used in PCs).
     
  5. Xenobius

    Xenobius

    125
    0
    May 15, 2012
    Hello and thanks for your replies.

    Ok so as I understand this, the code that I need to learn isn't going to be much different but a 32-bit uC will offer much more than an 8-bit can (obviously)

    Ok thanks a lot for clearing this up :)
    X:cool:
     
  6. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,270
    Nov 28, 2011
    The source code for simple programs will be identical or very similar. When you start using the built-in peripherals, the differences will be significant.

    When you get into debugging you will need to become familiar with the architecture and instruction set. A larger processor will have a more complicated instruction set and more complicated internal peripherals, but that's just something you have to live with if you need the advantages of a 32-bit device.
     
  7. Xenobius

    Xenobius

    125
    0
    May 15, 2012
    Well lets put it this way, I only ever programmed Arduino which is very simple compared to these as I see it.

    I will need to learn both architectures anyways but at least I know what to expect now. What I am clueless (but I didnt search so its not fair to ask) is were to start from. I know I need Studio 6 from Atmel but thats it... I will search for tutorials and whatnot.

    Thanks :)
     
  8. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,270
    Nov 28, 2011
    Arduino is just AVR with a serial downloader and lots of support software, right?

    Yes, I'm sure ARM will be a lot more complicated. But it's an architecture worth learning. Most smartphones use ARM cores. I should be learning it too. :-(
     
  9. Xenobius

    Xenobius

    125
    0
    May 15, 2012
    I going to finish off a project that I have on the 20th of this month and than its all AVR.
    Will post some question probably.

    Cheers
     
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

-