Shop OBEX P1 Docs P2 Docs Learn Events
Selectable Events, pin high vs. rising, how to timeout [solved] — Parallax Forums

Selectable Events, pin high vs. rising, how to timeout [solved]

ManAtWorkManAtWork Posts: 2,176
edited 2022-02-18 15:40 in Propeller 2

What exactly is the difference beween the following configuration values for SETSEn?

%001_PPPPPP = INA/INB bit of pin %PPPPPP rises

and

%11x_PPPPPP = INA/INB bit of pin %PPPPPP is high

My interpretation is this: If the input pin is initially low and then becomes high for the first time the behaviour is basically the same. An event would be triggered for both modes. In both cases only a single event would be generated because only a "fresh" condition (rising edge) triggers one.

But what happens when the event is acknowledged (cleared) by a POLLSE or WAITSE command? I think in this case the "is high" mode would immediately re-trigger while the "rises" mode would not until the pin becomes low and then high again. Is this correct?

Comments

  • evanhevanh Posts: 15,915

    Yep. AFAIK, an event latch will still be remembered until consumed. So, the level mode (%11x_...) will immediately re-latch as a new event unless the high pin has gone low already. I think most cases it's the rise desired to be known rather than high level.

  • Ok, I can confirm that it works as expected.

                  mov     tmp,#%110<<6+pinGreen
                  setse1  tmp                      ' Event: CRS=green trace is high
    ...
    waitIpg       getct   tmp
                  add     tmp,#timeout
                  drvh    #pinRed
                  setq    tmp
                  waitse1 wc                        ' wait min inter-packet gap, C=timeout
                  drvl    #pinRed
            if_nc jmp     #waitIpg                  ' repeat if CRS=1 detected (not idle)
    

    If I abort reception of a packet in the middle and jump to the WaitIpg procedure the event is constantly re-triggered. When CRS (green trace) becomes low the next WAITSE1 command times out after the minimum inter-packet gap. If I change the event mode for SETSE1 from %110 to %001 the red brick wall is gone and the event really triggers only at rising edges.

  • evanhevanh Posts: 15,915

    You're green trace is decidedly yellow, looking at the photo.

  • "Red wire? Blue wire? Huh? I only see a dark grey and a light grey one!" (Hangover 2) :D

Sign In or Register to comment.