Getting started with micro controllers

Discussion in 'Embedded Systems and Microcontrollers' started by Engineer_tech, Nov 26, 2014.

  1. Engineer_tech

    Thread Starter Member

    Sep 19, 2014
    31
    1
    Hi
    I am planning to start learning micro controllers (programming ).i have studied few subjects in my school related to micro controllers(PIC and 8051) few years back but since then i didn't get a chance to work with micro controllers.i am kind of confuse on where to start to refresh my knowledge and start working.

    i am putting this question to take expert advises from all the great contributors out here.please suggest me some good resources to get started.

    Thank you all
     
  2. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,884
    1,001
  3. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,526
    2,369
  4. Engineer_tech

    Thread Starter Member

    Sep 19, 2014
    31
    1
    thank you for the replies.The suggested wesbites seems to be a great resource for starters.
    i would like a quick advise on whether I should start from assembly language first or directly from C.As i already have bit of experience with C so what you guys suggest?
     
    Last edited: Nov 26, 2014
  5. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,526
    2,369
    Basically personal preference and what you are comfortable with.
    Even with C, some assembly knowledge is needed.
    Max.
     
    absf likes this.
  6. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,884
    1,001

    Some people like assembly because they say it helps you understand the ship better. There might be some merit in that idea but I don't really think that level of understanding is necessary. Almost no one today programs PCs in machine code. They in fact use hundreds of libraries where they do not know what is going on inside the library. But they still turn out some very robust programs.

    So you can spend your time learning the complexities of assembly or you can use that same time to quickly create some really nice projects using a higher level language like C.


    My advice is to get going with an easier language like C so you do not get frustrated. Later you can learn assembler if you want to get closer to the chip.
     
    absf likes this.
  7. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,526
    2,369
    When I started out assembly was the only game in town, unless you wanted to go the Pascal route etc, so I have stuck with it and now find it very easy to convert over to the small instruction set of Picmicro.
    Max.
     
    Engineer_tech likes this.
  8. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,360
    absf likes this.
  9. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,388
    497
    MrChips makes interesting point. Take something simple like flashing led. You can easily write it in C, and it is not really hard to write it in assembly. On the other hand, I would dread writing large-ish program in assembly when I can do it somewhat easily in C.

    My microcontroller class was on 8051. The textbook that we used for that class had both, examples in assembly and same or nearly same examples in C. So, if you still have your old textbooks... you could do both.
     
    absf and Engineer_tech like this.
  10. Engineer_tech

    Thread Starter Member

    Sep 19, 2014
    31
    1
    Ya i would like to try both my understanding is C is far more easier and easily manageable in terms of changing and playing around with program.
    i do remember my first lesson was some what mix of c and ASM.
    the reason i am posting here to get advise from you guys so i can remain focused.Grabbing things from here and there isn't helping me a lot.
    i have two choices either i have to go back and study my school text book or follow one platform(PIC/AVR or MSP430) and website for now and move on from there.
    all i need is guidance from where to start.slowly and gradually i would learn to switch between micro controllers.

    thanks for all contributors for taking time out and suggesting me some great resources.
     
  11. sirch2

    Well-Known Member

    Jan 21, 2013
    1,008
    351
    Mr Chips, hopefully this is not too off topic but I have noticed that you often recommend the MSP430, I also respect your opinion and you seem like the sort of person who would think these things through so, if possible, I would be interested in a brief summary of why you favour the MSP over PIC or AVR?
     
  12. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,388
    497
    "I hear them fighting words!"
    ☺7
     
  13. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,360
    I teach this stuff. I wouldn't want to teach Microchip PIC ASM.

    I love teaching Freescale HC11 or HC12 ASM.
    Atmel AVR gets second prize from me.
    TI MSP430 ranks third place.

    Why do I recommend MSP430 Launchpad? Because it is the lowest priced development kit on the market (used to be $4.30 but now $10) and IAR Embedded Workbench tops them all.
     
    Last edited: Nov 26, 2014
    sirch2, Engineer_tech and absf like this.
  14. iimagine

    Active Member

    Dec 20, 2010
    129
    9
    Here is my 2 cents:
    Code (Text):
    1. boolean whatToDo()
    2. {
    3.   if (you know C) then
    4.   {
    5.     if (startsWithC() < speedNeeded) then
    6.       return optimizeInASM(findBottleNeck());
    7.     else
    8.       return imHappy();
    9.   }
    10.   else
    11.   {
    12.     learnC();
    13.     return whatToDo();
    14.   }
    15. }
    16.  
     
    Engineer_tech and absf like this.
  15. Engineer_tech

    Thread Starter Member

    Sep 19, 2014
    31
    1
    that's quite explanatory .
     
  16. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,360
    From my perspective as an educator in electronics and computer technology, the purpose of learning ASM is not to optimize one's code but to gain a solid understand of computer technology.

    There are many concepts in C that are difficult to grasp and understand unless one is exposed to the inner operation of the machine. Examples are data types, data structures, unions, logical versus boolean operations and of course, pointers.

    To become a thorough expert in computer technology, the logical progression in learning would be firstly, digital logic and then assembler language before moving up to a higher level language such as C. But that's ok to come at it from a different direction.
     
    absf likes this.
  17. absf

    Senior Member

    Dec 29, 2010
    1,492
    372
    Just downloaded the instruction set of the MSP430G2553. One day I'm gonna try it out to just flash a LED. Is an assembler needed to write in assembly or I can enter the code in the IAR IDE enviroment?

    Allen
     
  18. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,360
    You create ASM code in the IAR IDE.
    Here is an example:

    Code (Text):
    1.  
    2. #include "msp430.h"
    3.  
    4.   PUBLIC mytest
    5.   RSEG CODE ;code is relocatable
    6.      
    7.   mytest:
    8.  
    9.   clr.b &P1OUT
    10.   mov.b #0x01, &P1OUT
    11.  
    12.   ret
    13.              
    14.   END
    15.  
    Create a file and give it a name such as test.asm
    Add the file to the project.

    The code defines the entry point "mytest".
    All the code does is clears PORT1 and then writes 01 to PORT1, in effect toggling P1.0
    Then the code returns to the calling program.

    In your calling program, declare

    extern void mytest(void);

    simply insert in your main program loop:

    mytest();
     
    absf likes this.
  19. sirch2

    Well-Known Member

    Jan 21, 2013
    1,008
    351
    Thanks.
     
  20. sirch2

    Well-Known Member

    Jan 21, 2013
    1,008
    351
    Not at all, I was genuinely interested. I use PIC's, AVRs and Arduino (I know, I know, it's an AVR but I mean the whole platform as opposed to a bare ATMega) so I have no axe to grind and I like to use the right tool for the job. I have never used the MSP430 and am interested in what it offers and could it be another tool in the box.
     
Loading...