Shop OBEX P1 Docs P2 Docs Learn Events
Waitpne question — Parallax Forums

Waitpne question

T ChapT Chap Posts: 4,223
edited 2009-05-15 02:06 in Propeller 1
Can anyone explain why the speaker is beeping in this loop?

I was trying to trace out by process of elimination why the loop that contains a lot of code keeps looping when conditions don't seem to be met for the waitpne to let anything through. When I got finished 'muting' all the masks to '0' as shown, it still kept beeping.

     repeat
       spk.beep(19, 8000, 20)
       waitpne(%10100_00000000_00000100, %00000000_00000000_00000000_00000000, 0)

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-05-15 01:46
    When you mask all the input pins to zero, the result of the implicit AND can never be a non-zero value. Therefore a waitpne with any non-zero comparison value will never wait.

    -Phil
  • T ChapT Chap Posts: 4,223
    edited 2009-05-15 02:06
    Thanks Phil, found the culprit.
Sign In or Register to comment.