Problem saving variables?

Status
Not open for further replies.

Rod Harty

New Member
I'm using a Mplab IDE v8.92 compiler. I can assign a variable to a value:
movlw b'00000111'
movwf var1 ;initialize var1
the watch box shows that the memory position (in this case, 0x20) holds the correct value.
However, when I retrieve the value;
clrw
movlw var1
the work register shows the memory position, not the value contained.

Ideas?
 
If you show your whole code it will help. One of the "gottchas" of Assembly is the movlw instruction. It will return the register location, which BTW is very useful for setting up indirect addressing. Try, "movf register,w"

John
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…