Total members 11838 |It is currently Thu Dec 03, 2020 11:09 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





  1. A group of instructions that are grouped together and assigned a name.
  2. One or multiple arguments can be input to a macro.
  3. By entering the macro name, the same group of instructions can be duplicated
    in any place of the program.
  4. User program is made more readable by using macros.
  5. User becomes more productive by saving the text entering time.

Macro Directives
  • macro
  • endm
  • exitm

Macro Definition Examples
Code:
eeritual macro ; macro name is eeritual
movlw 0x55 ; instruction 1
movwf EECON2 ; instruction 2
movlw 0xAA ; instruction 3
movwf EECON2 ; instruction 4
endm

Macro Call Example
Code:
eeritual ; this macro call causes the
; assembler to insert
; instruction 1 … instruction 4


Another Examlpe
Code:
sum_of_3 macro arg1, arg2, arg3 ; WREG <- [arg1]+[arg2]+[arg3]
movf arg1,W,A
addwf arg2,W,A
addwf arg3,W,A
endm
sum_of_3 0x01, 0x02, 0x03 ; WREG <- [0x01] + [0x02] + [0x03]




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : macro usage PIC assembly
 Control Directives usage PIC assembly     -  
 Object File Directives Usage PIC Assembly     -  
 PIC Assembly For Loop Example     -  
 multiply two numbers in PIC assembly     -  
 TEMPERATURE AND HEAT CONTROL Assembly     -  
 MULTIPLEXING Seven SEGMENT DECODER Assembly     -  
 playfair cipher assembly code     -  
 Elements of Assembly Language Instruction     -  
 Motor DC Speed Control by switching ON and OFF Assembly     -  
 Infra Read Sensor to Control DC motor Assembly     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com