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

Assembler Code Deciphering (beginner)

Discussion in 'Homework Help' started by BobSparky1996, Dec 9, 2017.

  1. BobSparky1996

    BobSparky1996 New Member

    Joined:
    Dec 9, 2017
    Messages:
    8
    Likes:
    0
    XORWF X,w
    btfsc STATUS, Z

    Please could someone tell me what these two lines of code mean?

    - Bob
     
  2. MaxHeadRoom78

    MaxHeadRoom78 Well-Known Member

    Joined:
    Jun 9, 2015
    Messages:
    1,052
    Likes:
    92
    Location:
    Canada Geog Cen of N.A.
    XORwf is one way of toggling certain bits when the word used has any bit that is set to toggle the subject bits..
    IOW
    XXXX XXXX
    0000 1111
    the result will be the LSB gets toggled in the upper subject word.
    The next instruction is skipped if the result of the XOR word is zero.
    A way of testing a register for a certain value.
    Max.
     
    Last edited: Dec 9, 2017
  3. BobSparky1996

    BobSparky1996 New Member

    Joined:
    Dec 9, 2017
    Messages:
    8
    Likes:
    0
    Okay brilliant thanks Max!

    - Bob
     
    Last edited: Dec 11, 2017
  4. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10


     
  5. MaxHeadRoom78

    MaxHeadRoom78 Well-Known Member

    Joined:
    Jun 9, 2015
    Messages:
    1,052
    Likes:
    92
    Location:
    Canada Geog Cen of N.A.
    Would have to see your hardware diagram, how are you reading the Pot?
    Max.
     
  6. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    6,280
    Likes:
    555
    Location:
    Cleveland, OH, USA
    Welcome to ETO.

    Your code will be easier to read if you use code tags to post it like this: [code=asm] place code here [/code]

    As for the code itself, you are moving the value 100 to a counter and decrementing that each loop until it equals X (max value 30). If not equal to counter, you delay 100 us, decrease counter, and loop. When equal to X, you set an LED then continue looping until counter =0 and skip to something else.

    One concern, assuming that interpretation is correct, is that 100x 100 us + a few instruction cycles = 10 ms + a little. I don't think you will see anything change. At least, the flask will be quick.

    John
     
  7. BobSparky1996

    BobSparky1996 New Member

    Joined:
    Dec 9, 2017
    Messages:
    8
    Likes:
    0
    Cheers :)
     
    Last edited: Dec 11, 2017

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice