Continue to Site

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.

  • 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.

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.

Latest threads

Back
Top