Shop OBEX P1 Docs P2 Docs Learn Events
PASM 101 - Manipulation I/O Pins - Page 2 — Parallax Forums

PASM 101 - Manipulation I/O Pins

2»

Comments

  • tonyp12tonyp12 Posts: 1,951
    edited 2014-01-18 19:45
    >ANDN always clears if the mask is zero?
    Zero before or after the N in ANDN inverts it?

    clk_pin long %00000000000000000000000010000000 ' P7

    ANDN OUTA, clk_pin

    The N will invert that to %11111111111111111111111101111111 before it ANDs it with OUTA (for example)
    As you can see,
    all the locations with a 1 will leave the source the same and only the single 0 will change the source bit to a 0
  • MJBMJB Posts: 1,235
    edited 2014-01-25 08:20
    I view it this way:

    MASK is a mask where the 1's set indicate the positions I am interrested in e.g. the IO-Pins

    then:
    OR OUTA, MASK \ is equivalent to SETbyMASK OUTA, MASK and sets the positions given by 1's in MASK to 1
    ANDN OUTA, MASK \ is equivalent to CLEARbyMASK OUTA, MASK and clears the positions given by 1's in MASK to 0

    this allows to use only one mask for set and clear and not two different ones that you would need with OR and AND only.

    if there were MACROS I would define SETbyMASK and CLEARbyMASK to make the meaning more obvious
  • lardomlardom Posts: 1,659
    edited 2014-01-25 23:45
    I printed this out as soon as I saw it! Great job. Thank you.
  • MJHanaganMJHanagan Posts: 189
    edited 2014-01-27 17:55
    Thanks to all who help with corrections and suggestions for edits for this small set of Beginner PASM notes. I just replaced the original version with an updated pdf in the original thread post.
  • ErlendErlend Posts: 612
    edited 2014-01-29 11:31
    Downloaded and saved in my essential prop-knowledge library. Thanks!

    Erlend
Sign In or Register to comment.