Shop OBEX P1 Docs P2 Docs Learn Events
Gaaah! Need help understanding WAITPEQ... — Parallax Forums

Gaaah! Need help understanding WAITPEQ...

SteelSteel Posts: 313
edited 2010-09-08 17:24 in Propeller 1
Sorry, I have searched the forums and haven't really found what I am looking for, and I am trying to understand the manual, but it isn't working in my program.

I am in PASM.

I want to hold my program until P31 goes low.

Here is my code:

some label
WAITPEQ 0 ,#rxpinmask
some code
.......

rxpinmask long $80_00_00_00

The code is not executing after the WAITPEQ command. as far as I can tell in the manual, the first number is what to compare the value to after INA has been ANDed with the second value.

...So...rxpinmask is only allowing P31 to be monitored. When P31 goes low, it triggers a "0" which matches with my value.

Yet it still doesn't work. Am I missing something? I know it may seem like a lame question.

Shaun

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-09-08 16:09
    The problem you're running into is that you're trying to put a 32 bit value into a 9 bit immediate value field and all you get is the low order 9 zeros. You need to define your mask as a separate 32 bit long, then put the address of that mask in the source field of the WAITPEQ (without the #) like this:
    WAITPEQ   0,waitBitMaskLong
    
    waitBitMaskLong   long   $80_00_00_00
    

    The way you wrote it (with the #) uses the address of rxpinmask as your mask rather than the mask itself.
  • kuronekokuroneko Posts: 3,623
    edited 2010-09-08 17:24
    WAITPEQ   0,waitBitMaskLong
    
    waitBitMaskLong   long   $80_00_00_00
    

    Additionial issue, the destination slot doesn't take immediate values so unless your first instruction in the cog (address 0) is a nop it won't work either. So in your case just use the opposite condition:
    WAITP[COLOR="Red"]NE[/COLOR]   waitBitMaskLong, waitBitMaskLong
    
    waitBitMaskLong   long   $80_00_00_00
    
Sign In or Register to comment.