Writting MACRO in assembly for Atmel 8051 microcontroller

Thread Starter

eng.me

Joined Dec 10, 2012
27
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.

Rich (BB code):
add32 MACRO dest , src
movf  src+3 ,w
addwf dest+3,f
movf  src+2 ,w
addwf dest+2,f
movf  src+1 ,w
addwf dest+1,f
movf  src+0 ,w
addwf dest+0,f
the above code is for PIC micro.
 

Papabravo

Joined Feb 24, 2006
21,159
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.

Rich (BB code):
add32 MACRO dest , src
movf  src+3 ,w
addwf dest+3,f
movf  src+2 ,w
addwf dest+2,f
movf  src+1 ,w
addwf dest+1,f
movf  src+0 ,w
addwf dest+0,f
the above code is for PIC micro.
You absolutely can write MACROS using any assembler that supports the capability.
 

kubeek

Joined Sep 20, 2005
5,794
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.
 

Papabravo

Joined Feb 24, 2006
21,159
Thank's Papabravo But what about Atmel 8051 microcontroller Assembly language?
Is it possible?
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.
 

Thread Starter

eng.me

Joined Dec 10, 2012
27
what about Kiel assembler?
Can anyone give me the name of one of those assembler? PLZ.
 
Last edited:
Top