number of insructions in microcontroller

Discussion in 'Programmer's Corner' started by abhi.creations, Sep 10, 2007.

  1. abhi.creations

    Thread Starter New Member

    Sep 10, 2007
    9
    0
    hi all,
    can any person provide me information about the number of
    instructions in different microcontrollers.
    i need to know some microcontroller (PIC, ARM etc.) having approx 16 to 20 instructions.
    actually i have to choose a low instructions microcontroller
    for designing its assembler. its urgent for me.

    please suggest me and provide some support to me.
    i will ne very thankful to all of you.
     
  2. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    How about this little PIC processor? Since it is a 4-bit device its instruction set contains just 33 instructions.

    hgmjr
     
  3. HarveyH42

    Active Member

    Jul 22, 2007
    425
    5
    Regular 8-bit PICs have 36 instructions.
    AVR have around 130 instructions (what I use).

    I chose the AVR, mostly because it had such a rich instruction set and I was looking to program in assembler. Also, PIC has just one working register, AVR has 32.
     
  4. Eduard Munteanu

    Active Member

    Sep 1, 2007
    86
    0
    HarveyH42, he wants to write his own assembler. Having to implement fewer instructions/opcodes makes things easier.
     
  5. Papabravo

    Expert

    Feb 24, 2006
    10,140
    1,790
    Not much. I do not think that the number of instructions has much correlation to the complexity of an assembler. IMHO the most complex aspect of an assembler is creating, managing, and sorting the symbol table. Any damn fool can implement a linear search and watch the performance plumet exponentially as the number of symbols grows linearly.

    Another complex part is generating a useful assembly listing with appropriate diagnostics.

    The opcodes are contained in a pre-sorted list. Matching them to the input text is very nearly trivial.

    I've written several assemblers and I don't know where this quaint notion comes from.
     
  6. abhi.creations

    Thread Starter New Member

    Sep 10, 2007
    9
    0
    hi thanx papabravo ,
    can you provide me any ebook link or any good pdf for understanding the concept of assembler design and coding.
    one more thing is that i have to write the code in c language.

    i am thinking to choose simple pic microcontroller.
     
  7. Eduard Munteanu

    Active Member

    Sep 1, 2007
    86
    0
    You're right, but what I meant was "less time spent on typing into the symbol table = more time available to understand, design and code".
     
  8. abhi.creations

    Thread Starter New Member

    Sep 10, 2007
    9
    0
    hi, can you send me any tutorial for assembler design and coding. its urgent for me. i am new in this stuff.
     
  9. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    Here is a website with a wealth of material on rolling your own assembler.

    hgmjr
     
  10. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    This site might be a good place to start - http://webster.cs.ucr.edu/AsmTools/RollYourOwn/.

    One thing to think about - if you are going to the trouble of writing an assembler, why not choose a microprocessor that has some useful features? Instead of the smallest instruction set, find one that might be interesting to design some projects with afte you get the assembler written.
     
  11. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    beenthere,

    It surely must be true that great minds think alike.

    What are the odds of both of us posting a link to the same site within the same minute?

    And a cool site at that.

    hgmjr
     
  12. abhi.creations

    Thread Starter New Member

    Sep 10, 2007
    9
    0
    thats fine,
    but the site you have given is about programming from assembly languages.

    what i need is to design my own assembler. and i have to code that design in c.
    finally what i will be having in output will be an assembler.
     
  13. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    You should be able to apply the techniques presented at the website independent of the language you elect to use to implement the assembler.

    Writing an assembler is a tedious and involved process regardless of the language used and not to be undertaken lightly. Parsing the source code syntax alone is a significant challenge. Add to that the need for syntax and runtime error checking and you definitely have your work cut out for you.

    Good Luck,
    hgmjr
     
  14. abhi.creations

    Thread Starter New Member

    Sep 10, 2007
    9
    0
    hi
    i have created a new Thread as " assembler design and coding" because the name of this thread is not appropriate for assembler design. so most of the person who can help in this problem may not be having a look in this thread.
    thanx
     
  15. Papabravo

    Expert

    Feb 24, 2006
    10,140
    1,790
  16. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    Don't forget the venerable Table Assembler. I think TASM is still around.

    To hgmjr - as long as you don't have to sweat all the bells and whistles, GW Basic should be able to do an assembler. I wrote an extension for the Rockwell 65C02 instruction subset and made some improvements to an assembler written in Applesoft Basic about 20-some years ago. Basic makes parsing text inputs a snap.
     
  17. Eduard Munteanu

    Active Member

    Sep 1, 2007
    86
    0
    One can use parser generators for C/C++, like yacc/lex, if the language allows it. For an assembler it almost surely does. You get less bugs and headache.
     
  18. Papabravo

    Expert

    Feb 24, 2006
    10,140
    1,790
    I found the learning curve for lex/yacc to be more trouble then it was worth.
     
Loading...