Shop OBEX P1 Docs P2 Docs Learn Events
rdlong between two waitpeqs — Parallax Forums

rdlong between two waitpeqs

ionymousionymous Posts: 29
edited 2008-11-12 00:19 in Propeller 1
I am coding in assembly.
Over the weekend I found a bug in my assembly code that was killing me.

I've changed my code quite a bit since then, but the general idea is that I had a rdlong between two waitpeq.
Something like:
waitpeq  someBitMask2, someBitMask1
rdlong   someVar, someAddress
waitpeq  someBitMask3, someBitMask1
add      gotHereCount, %1



This was all in a loop and so my counter at the end was incrementing very quickly. I output it to a TV.
But the rdlong didn't seem to be working. someVar wasn't getting updated as I expected.

I then move the rdlong to after the second waitpeq, and it worked fine. Like this:
waitpeq  someBitMask2, someBitMask1
waitpeq  someBitMask3, someBitMask1
rdlong   someVar, someAddress
add      gotHereCount, %1



Is there something I'm not understanding here? Or must this be a side effect of some other part of my code?

Thanks for any help
Ion

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-11-12 00:19
    The amount of time a rdlong will take in this circumstance is indeterminate, ranging anywhere from 7 to 22 clocks. It's possible that your input pin toggled completely between waitpeqs, leaving the second one hanging.

    -Phil

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Just a few PropSTICK Kit bare PCBs left!
Sign In or Register to comment.