Rookie Question: AVR, PIC, ARM?

Discussion in 'Embedded Systems and Microcontrollers' started by fitzthecool, Oct 3, 2015.

  1. fitzthecool

    Thread Starter New Member

    Aug 20, 2015
    5
    0
    Hello, I am a couple months into playing with my Arduino. It has occurred to me that if I want to really know what's going on, I need to learn C, and start programming controllers at a lower level. I have no electronics or programming background, but I am a pretty quick study. That said, I would love to start on the right foot. I have read a ton of different things that lead me in all different directions, as far as which microcontroller to learn first.

    Can anyone recommend a good way to get going both learning embedded C and a particular controller?
     
  2. ISB123

    Well-Known Member

    May 21, 2014
    1,239
    527
    kubeek and fitzthecool like this.
  3. dannyf

    Well-Known Member

    Sep 13, 2015
    1,835
    367
    "
    Can anyone recommend a good way to get going both learning embedded C and a particular controller? "

    at the basic levels, they are all the same,. You peek at some memory locations and you poke at other memory locations zero difference, as long as you stay at a high level language.

    from a programming perspective, c is c. There are some peculiarities for embedded c, both chip and tool specific but that's minor. It is much more important to learn c than to learn embedded c.

    as to chips to learn, if you want to make a living out of it, pick an arm chip to learn. They have much more complicated peripherals so expect a steeper learning curve.

    if you are learning for fun, any chip would do. I would recommend a simpler chip to learn on, like the avr or pic24.
     
    fitzthecool likes this.
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,395
    1,607
    Pick a controller. Any controller really. But pick one inside a development board since you will need some training wheels for a while.

    Don't skimp on the programmer, get one that can do in circuit debugging so you can watch exactly what your code is doing without any guessing.

    I do PIC processors, so to start with these I would recommend this.
     
  5. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,693
    2,763
    Others get tired of me saying this, and many violently disagree with me, but here it goes anyway:

    Learn .asm first. This will allow you to become intimately familiar with the hardware, understand the hardware/software interaction, and provide a foundation for later programming effectively in C, if you choose to.

    Embedded C varies from hardware to hardware (as does the .asm), and compiler to compiler (unlike .asm). Proficiency in .asm will substantially improve your ability to write good C in the future. You will also discover that there are some things that .asm will always be better at than C -- things that you can implement as 'inline' code when C provides no good solution.
     
    absf, atferrari and OBW0549 like this.
  6. OBW0549

    Well-Known Member

    Mar 2, 2015
    1,328
    890
    I second joeyd999's recommendation: learn assembly language programming first, for exactly the reasons he cites. You'll be glad you did.
     
  7. dannyf

    Well-Known Member

    Sep 13, 2015
    1,835
    367
    I would caution against against learning assembly. It has limited uses in real life applications, it is much harder to learn, it is very difficult to port and to maintain, ...

    mcis sre becoming commodities increasingly. The winning strategy from a software perspective is to treat it more like a commodity, an appliance where you don't need to know the inner workings as the compiler takes care of it for. Instead forcus on your value add, which is clearly not in generation of assembly code, for any programmer worthy of his or her two cents.
     
  8. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,693
    2,763
    I am obviously not worthy of my two cents.
     
  9. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    I say compromise. Don't learn assembly, but be aware that it's there. Take a few looks at the list file your compiler generates and see what each line of C compiles into, and look up a few of the assembly instructions in the processor's manual. You don't have to be able to write much in assembly, but it can certainly be helpful to see what kind of thing each instruction does.

    As for a processor to start with, if you have any real live friends around who use a particular type, use that. Starting from scratch, there are so many pitfalls and blockages that you'll come to, that you'll save days of frustration if someone can explain the problems for you. You might even be saved from shoving the whole mess in a drawer and deciding it's just not the game you want to play.

    But if you want to, or have to, do it all alone, then ISB123 is making sense. If you're getting anything done with your Arduino, then you've already programmed an AVR. That's a head start that ought to help you understand the AVR chips.
     
  10. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,395
    1,607
    Knowing assembly is not in any way essential to working with any device.

    Learning assembly first may teach you very poor techniques in structuring your code (as assembly has no structure but that you impose on it).

    Any high level language such as C will get you to doing productive things quickly. Then one day when you are confident in your programming skills only then look into assembler.
     
  11. dannyf

    Well-Known Member

    Sep 13, 2015
    1,835
    367
    Assembly programmers tend to fall into two categories:

    1) extremely good: the use of assembly helps them push the hardware's performance envelope, to do things that otherwise are not possible in a high-level language;
    2) people who are satisfied with doing simple things with the hardware: they usually don't mount to much, particularly on more complex hardware.
     
Loading...