Writting MACRO in assembly for Atmel 8051 microcontroller

Discussion in 'Embedded Systems and Microcontrollers' started by eng.me, Mar 15, 2013.

  1. eng.me

    Thread Starter New Member

    Dec 10, 2012
    27
    1
    Hi
    I'm new to Atmel 8051 microcontroller Assembly language.
    Is it possible to write a MACRO in assembly for 8051 microcontrollers then call it any where I need it?
    like the one below of PIC microcontrollers.

    Code ( (Unknown Language)):
    1. add32 MACRO dest , src
    2. movf  src+3 ,w
    3. addwf dest+3,f
    4. movf  src+2 ,w
    5. addwf dest+2,f
    6. movf  src+1 ,w
    7. addwf dest+1,f
    8. movf  src+0 ,w
    9. addwf dest+0,f
    10.  
    11.  
    the above code is for PIC micro.
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,140
    1,789
    You absolutely can write MACROS using any assembler that supports the capability.
     
  3. eng.me

    Thread Starter New Member

    Dec 10, 2012
    27
    1
    Thank's Papabravo But what about Atmel 8051 microcontroller Assembly language?
    Is it possible?
     
  4. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    AFAIK there is more than one assembler for atmel chips. You first need to find out what tool you´re using and then look into the documentation.
     
  5. Papabravo

    Expert

    Feb 24, 2006
    10,140
    1,789
    The answer is yes. There is at least one assembler you can acquire that will let you write macros for the 8051. You don't have to use the one from Atmel. As has been suggested you need to consult the documentation.
     
  6. eng.me

    Thread Starter New Member

    Dec 10, 2012
    27
    1
    what about Kiel assembler?
    Can anyone give me the name of one of those assembler? PLZ.
     
    Last edited: Mar 21, 2013
  7. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Yes, Kiel A51 has macros.
     
Loading...