Shop OBEX P1 Docs P2 Docs Learn Events
WAITCNT'ing in 2 Cogs & Conflict? — Parallax Forums

WAITCNT'ing in 2 Cogs & Conflict?

PJAllenPJAllen BannedPosts: 5,065
edited 2011-04-02 16:54 in Propeller 1
I have a couple of things going on, in two cogs,
both use a WAITCNT delay.

I guess they need to be synchronised, there's a conflict.
Changing the values can make for interesting results.

It chugs along successfully for several (5) iterations
and then... it konks out, freezes.

Attaching my dilemma.
How can I harmonise the two?

Comments

  • RaymanRayman Posts: 14,996
    edited 2011-04-02 16:43
    Looks like ausgang calls itself... That will likely overflow the stack, I think...
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-04-02 16:46
    Both Augang and Rotate call themselves recursively without an end condition. You're getting stack overflow. Perhaps you meant this instead:
    PUB Ausgang  
      repeat
        outa [7..0] := ausbus
        waitcnt(150_000 + cnt)
    
    PUB rotate
      repeat
        stgcntr := 0
        repeat 8
          ausbus := stage[stgcntr]
          stgcntr := stgcntr + 1
          waitcnt(clkfreq / 8 + cnt)
    

    -Phil
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-04-02 16:54
    Ja!
    That's it.
    I have to remember about "repeat" instead of the Method's name (a-la "GOTO", etc.)

    Thanks!
Sign In or Register to comment.