Shop OBEX P1 Docs P2 Docs Learn Events
Question on WAITPNE and transitions — Parallax Forums

Question on WAITPNE and transitions

Hello. Been a while since I've been active.

So, I have a question on monitoring some pins. Let's say I have 8 pins from an external chip that will never have more than one pin LOW at the same time. All could be HIGH but only one could ever be LOW. Such as from a 74'138.

Now, I'd like the Propeller to monitor those 8 outputs and execute a simple bit of code depending on which of the pins is active low.

For example, if I tied the 8 outputs to P0-P7 and P3 is LOW, then I'd like P14 to be HIGH. Etc.

I'm a little confused on how I would use WAITPNE (PEQ) with this scenario. How would the wait command know that ANY of the bits could trigger the code?

Hope that makes sense. Any tips would be appreciated.

Oh, this will be in PASM.

Thanks!



Comments

  • Tracy AllenTracy Allen Posts: 6,664
    edited 2017-06-05 18:50
    Like this? The waitpne ANDs the input pin state with %11111111, then compares that result with the mask, %11111111, and drops through if any bit is low.
    mov mask1, #$FF
    waitpne mask1, #$FF       ' literal is possible here for pins p0 to p7
    mov result, ina
    ' now test bits and take action based on which bit is low
    
Sign In or Register to comment.