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!
If someone could tell me how to load the value of a register into a variable, I would really appreciate it.
Eg: VAR1 SET XY
it only loads the address of the register into the variable, not its value.
I just need the value, it would solve my problem.
Thank you very much in advance.
If someone could tell me how to load the value of a register into a variable, I would really appreciate it.
Eg: VAR1 SET XY
it only loads the address of the register into the variable, not its value.
I just need the value, it would solve my problem.
Thank you very much in advance.
You seem to be just starting to learn about assembly language coding.
You should start by describing a little about what you know about using the Microchip controllers and tools. Like the part number of the controller, the version of the Microchip IDE, and the type of operating system you run on your work station. The answer should be something like: PIC16F887, MPLABX version 5.35, Windows 10.
It seems that Ian got you an answer while I was typing this.
There is now the partial answer: PIC18F24K22, MPLAB version 8.92 and Windows (no version mentioned)
Since you seem new to assembly language should we presume that you are using the "Absolute" mode of the MPASM assembler?
Most of the example code I have is for the "Relocatable" mode.
The "Absolute" mode is easier to comprehend but has some "features" that can make using the debugger somewhat confusing.
I have only used MPLAB version 8.92 on Windows. I suspect that running it on Linux may require some kind of Windows OS emulation. I hear this can be tricky to get the Microchip debug tools working.
Fails.
I did a simple test, but it's still not good.
85 will be in VAR1 and 200 will not be included.
In other words, I give the macro 85, not 200.
I do not understand.
All I need to do is load the value of a register into a variable that I can pass to the macro when the macro is called.
testm macro addr ; param is a variable address
banksel addr ;
movf addr,W ; W = value in 'addr'
endm
testv macro value ; param is a literal value
movlw value ; W = value
endm
Yes really - those aren't PIC instructions - check the list of instructions in the datasheets. It's an assembler directive, NOT an instruction. I suspect the OP is mostly getting confused by what are 'instructions' and what aren't.
Fails.
I did a simple test, but it's still not good.
85 will be in VAR1 and 200 will not be included.
In other words, I give the macro 85, not 200.
I do not understand.
All I need to do is load the value of a register into a variable that I can pass to the macro when the macro is called.
Code:
VAR1 EQU 85
TESTM MACRO A
MOVLW A
ENDM
MAIN
MOVLW 200
MOVWF CNT1
CLRF WREG
MOVF CNT1, W
MOVWF VAR1
TESTM VAR1
GOTO MAIN
Something is very wrong.
Check out.
When I call the macro, the address of the parameter is passed, not the value of VAR1.
The rest works fine, but this one is not good.
I would like to be able to send the value of VAR1 to the macro.
If I understand correctly, it is not possible to pass a parameter to the macro that is variable?
Something is very wrong.
Check out.
When I call the macro, the address of the parameter is passed, not the value of VAR1.
The rest works fine, but this one is not good.
I would like to be able to send the value of VAR1 to the macro.