• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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?
 

jpanhalt

Well-Known Member
Most Helpful Member
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.

Latest threads

EE World Online Articles

Loading
Top