Announcement

Collapse
No announcement yet.

FOR Loop triggering

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • FOR Loop triggering

    I am at it again. In my quest to find the (imo) true median of an even numbered population I am sorting (bubblesort) a list (array) of numbers.
    My population set(s) is small enough that I am not concerned with O(n2). I will not attempt to complete this in one scan. (one pass on one scan, wait a few mS, then continue - if needed.
    It works fine *if* I have the entry [ 0 -> Swapped ] in the CPD at the bottom of the code.
    The same line in the CPD at the top of the code does not seem to work. There *should* be a significant number of CPU scans between the start TRIGGER and the retrigger for Trig_V_Sort to have a new rising edge.
    Recalculating the Range_V is redundant. I need to move that out to an INITIALIZE and not recalc on every trigger.
    The FOR loop is triggered, but the code within does not seem to execute. -- Trig_V_Sort is ON -- RUNG 3 should turn it off!

    [EDIT] open image in another tab. It is clearer.

    Click image for larger version  Name:	ForLoopTrig.png Views:	0 Size:	151.0 KB ID:	130094
    Last edited by kewakl; 04-06-2020, 01:39 PM.

  • #2
    Try an Edge Contact vs the Coil you have now on line 2.

    Comment


    • #3
      I originally had that.
      one would think that you would achieve the same action since rung 3 has RST for that tag.

      Comment

      Working...
      X