Inquisitive
Super Moderator
Using Assembly language on MPLAB IDE 8.92.
Trying to walk through a few steps of code in MPLAB SIM and see how the program functions. It is not working like expected. Could somebody shed some light as to what I'm doing wrong or is not obvious to me.
At the end of this routine 12H should have a value of 22H and WREG = 88H
But, I'm not getting that. I only get 22H in WREG and 0 (zero) in W during simulation W does not change.
Also I'm not able to view location 12H in the simulator.
Any pointers or suggestion would be appreciated.
Here is the code I'm using:
Trying to walk through a few steps of code in MPLAB SIM and see how the program functions. It is not working like expected. Could somebody shed some light as to what I'm doing wrong or is not obvious to me.
At the end of this routine 12H should have a value of 22H and WREG = 88H
But, I'm not getting that. I only get 22H in WREG and 0 (zero) in W during simulation W does not change.
Also I'm not able to view location 12H in the simulator.
Any pointers or suggestion would be appreciated.
Here is the code I'm using:
Code:
#include <p18f458.inc>
LIST P=18F458 ;directive to define processor
;
org 0x000
;
MOVLW 0 ; moves (0) zero to WREG to clear it
MOVWF 12H ; moves WREG to location 12H to clear it
MOVLW 22H ; load WREG with value 22H
ADDWF 12H, W ; add WREG and location 12H, WREG = sum
ADDWF 12H, W ; add WREG and location 12H, WREG = sum
ADDWF 12H, W ; add WREG and location 12H, WREG = sum
ADDWF 12H, W ; add WREG and location 12H, WREG = sum
;
end