XORLW or XORWF

Status
Not open for further replies.

Suraj143

Active Member
Hi everybody I have a small question to ask.

I have saved a value in a temporary register called TEMP.
Actually I don’t know that value.
After a long time after PIC doing some other work I want to read that saved value.

Here I have two codes. What code do I have to use?

Code:
	movwf	TEMP	;move the value from temparary register
	xorlw	04H	;compare with a known value
	btfsc	STATUS,Z
	goto	OUTPUT

Code:
	movlw	04H	;move a known value to W
	xorwf	TEMP,w	;compare the value with TEMP
	btfsc	STATUS,Z
	goto	OUTPUT
 
Suraj143 said:
Code:
	movwf	TEMP	;move the value from temparary register

You need to be careful. The above instruction moves whatever value in W into TEMP register and destroy the value inside TEMP.

Use MOVF TEMP,W to get the TEMP value into W instead.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…