1. 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.
    Dismiss Notice

XORLW or XORWF

Discussion in 'Microcontrollers' started by Suraj143, Apr 28, 2007.

  1. Suraj143

    Suraj143 Active Member

    Joined:
    Jan 11, 2007
    Messages:
    1,565
    Likes:
    2
    Location:
    South Mald Isld
    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 (text):

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

        movlw   04H ;move a known value to W
        xorwf   TEMP,w  ;compare the value with TEMP
        btfsc   STATUS,Z
        goto    OUTPUT
     
     
  2. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,016
    Likes:
    317
    Location:
    Brisbane Australia
    They both do the same thing.

    Mike.
     
  3. eblc1388

    eblc1388 Active Member

    Joined:
    Jan 25, 2005
    Messages:
    2,228
    Likes:
    18
    Location:
    UK
    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.
     

Share This Page