PIC assembly macro parameter transfer

Status
Not open for further replies.

Peet19

Member
Hello!
I want to pass the value of a register to a macro, but I don't know.
How can this be solved?
Code:
 MOVLW 100
MOVWF XY

LOOP
MOVLW 10
SUBWF XY
VAR1 SET XY
BEIR VAR1

GOTO LOOP

I decreased the value of the XY register by 10 in each cycle.
If I enter the name of the register as a parameter of the macro, it does not pass the value.
I already tried changing the value of XY to a variable and passing it when calling the macro, but that's no good either.
What could be the problem?

Here is the macro:
Mist:
BEIR MACRO A
MOVLW A
MOVWF ZZ
ENDM

But if I enter a number when calling the macro it works.
I don't understand the problem.
Thank you in advance for your help!
 
Last edited:
I get it now.
Very good, thank you very much.
It worked
Inside the macro, MOVLW puts the address of the argument into W. MOVF, on the other hand, has its value.
I understand. I am very happy. Thanks for your help, once again
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…