Shop OBEX P1 Docs P2 Docs Learn Events
PLease, make it start. ** Problem solved ** — Parallax Forums

PLease, make it start. ** Problem solved **

PliersPliers Posts: 280
edited 2008-12-01 23:36 in Propeller 1
First let me say I enjoy reading this forum. You guys are great.
I really do try to figure this stuff out on my own.

On to my situation… I have a PPD board.
I’m using a scope, so I can watch my input and output pins.
If I comment out the waitpeq, I can see P0 pulse high.

Where did I go wrong?


   PUB IOTEST
   cognew(@IO_TEST, 0)

  DAT
    ORG 0
    IO_TEST

   MOV DIRA, #%0001        'Set PO as output

   waitpeq %0000, %0100    ' wait for P2 to go low
         
   MOV Outa, #1            ' Pulse P0 high
   MOV Outa, #0

  cogid     temp
  cogstop   temp

 temp  long   0


Post Edited (Pliers) : 12/1/2008 2:33:37 PM GMT

Comments

  • nutsonnutson Posts: 242
    edited 2008-12-01 13:33
    Manual page 412: WAITPEQ State, <#>mask
    You have the target state in register 0, and the mask in register %0100 ??
    Pulses from code that executes once ?? Try putting a JMP at the end to make the code loop back.
  • PliersPliers Posts: 280
    edited 2008-12-01 14:30
    Thank you very much nutson for the code.


    WAITPEQ data, mask


    data LONG %000
    mask LONG %100

    Post Edited (Pliers) : 12/1/2008 2:41:37 PM GMT
  • PliersPliers Posts: 280
    edited 2008-12-01 14:46
    Could somebody tell me what I'm missing in my understanding.
    Why does this not work
    "waitpeq %000, %100"

    But this does?

    WAITPEQ data, mask
    data LONG %000
    mask LONG %100
  • AribaAriba Posts: 2,687
    edited 2008-12-01 16:45
    The Assembly instructions can have two formats:
    1) instr destreg, srcreg
    2) instr destreg,#value
    You can't write a literal value as first parameter (destreg), only as second parameter (srcreg), and this value can only be in the range 0..511. These is a result of the way, the bitfields in the 32 bit instruction are allocated.

    For WAITPEQ you can use an immediate value as mask for the first 9 pins but not more, in all other cases you need registers (which have the full 32 bits).
    But mostly you can use the same register for data and mask:
    WAITPEQ pinmask,pinmask 'wait for pin(s) high
    WAITPNE pinmask,pinmask 'wait for pin(s) low

    Andy
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2008-12-01 23:36
    Good explanation Ariba.

    Pliers, basically you need the "#" in front of the %100. As Ariba pointed out you can only do that for values up to 511 (9 bits).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, uOLED-IOC, eProto for SunSPOT, BitScope
    www.tdswieter.com
Sign In or Register to comment.