Switch to full style
PIC Assembly Articles
Post a reply

macro usage PIC assembly

Thu May 09, 2013 10:17 pm

  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]




Post a reply
  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     -