Help with C_Counter reset

Home Forums Products Vsig and Preset Development Help with C_Counter reset

  • This topic is empty.
Viewing 5 reply threads
  • Author
    Posts
    • #106720
      sean.e
      Participant

      I'm using a C_Counter to select an input on an ISwitch.  The counter is driven by a trigger and the counter has another trigger for count reset.  That much works fine. 

      I'm also trying to automatically reset the counter if the trigger is pressed when the counter is at maxcount.  My problem with this bit is that I have to press the increment trigger twice for the automatic reset to occur.  Any ideas on how to avoid having to trigger multiple times for auto-reset?

      Here's what I've coded up:

      HEADM adc 2 2 iSwitchL-out iSwitchL-out Empty Empty 1 menupage-obj ;=0,0,100,0
      ISWITCH iSwitchL 4 SelectCounter-out adc-in1 adc-null adc-in1 adc-null ;=600,0,100,0
      C_MERGE resetCounter 2 SelectCounter-timeout reset-out ;=425,150,100,0
      STEXTKNOB SelectTextKnob %s select 4 0 SelectCounter-out "textknob: select 0" "textknob: select 1" "textknob: select 2" "textknob: select 3" ;=600,200,100,0
      C_MERGE incrementCounter 3 SelectTextKnob-textnum_out increment-out resetCounter-out ;=425,300,100,0
      C_COUNTER SelectCounter incrementCounter-out resetCounter-out 1 3 ;=600,325,100,0
      MENUPAGE menupage menupage menupage 5 increment-obj SelectTextKnob-obj counterMonitor-obj spacer-obj reset-obj ;=975,125,100,0
      MONITOR counterMonitor SelectCounter-out "counter:         %1.0f" cntMonitor ;=825,325,100,0
      TRIGGER increment increment increment ;=125,550,100,0
      TRIGGER reset reset reset ;=275,550,100,0
      TEXTLINE spacer "" ;=1100,200,100,0

      Repro by pressing the increment trigger until counter displays 3.  What
      I'm hoping for, is that the next press of the increment trigger will
      cause reset.  But instead, it takes two presses of the increment
      trigger to reset the counter.

    • #119664
      sean.e
      Participant

      By re-ordering the inputs to the C_Merge that is used to drive the
      counter clock input, I'm able to get the auto-reset to work without
      requiring multiple triggers at maxcount.  But it is done at the expense
      of the manual reset trigger.  The manual reset trigger works fine for
      all values except at maxcount – at which point it requires two
      consecutive trigger presses.  Fine trade off compared to the previous
      behavior.

      Here's the current version of the test:

      HEADM adc 2 2 iSwitchL-out iSwitchL-out Empty Empty 1 menupage-obj ;=0,25,100,0
      ISWITCH iSwitchL 4 SelectCounter-out adc-in1 adc-null adc-in1 adc-null ;=575,25,100,0
      C_MERGE resetCounter 2 SelectCounter-timeout reset-out ;=400,175,100,0
      STEXTKNOB
      SelectTextKnob %s select 4 0 SelectCounter-out "textknob: select 0"
      "textknob: select 1" "textknob: select 2" "textknob: select 3"
      ;=575,225,100,0
      C_MERGE incrementCounter 3 resetCounter-out SelectTextKnob-textnum_out increment-out ;=400,325,100,0
      C_COUNTER SelectCounter incrementCounter-out resetCounter-out 1 3 ;=575,350,100,0
      MENUPAGE
      menupage menupage menupage 5 increment-obj SelectTextKnob-obj
      counterMonitor-obj textKnobMonitor-obj reset-obj ;=950,150,100,0
      MONITOR counterMonitor SelectCounter-out "counter:         %1.0f" cntMonitor ;=800,350,100,0
      MONITOR textKnobMonitor SelectTextKnob-textnum_out textknobMon:%2.4f knobMonitor ;=800,225,100,0
      TRIGGER increment increment increment ;=100,575,100,0
      TRIGGER reset reset reset ;=250,575,100,0

      Now
      I'm trying to figure out why incrementing the STEXTKNOB only causes the
      C_Counter to increment once.  If you increment the textknob multiple
      times (using the up arrow key), its monitor (added in the current
      Show More...

      version of the test) shows the expected output of the knob, but the
      counter monitor only updates once – the counter and textknob monitors
      get out of sync.  Not so when using the Trigger instead of the
      STextKnob.

      Show Less...
    • #119668
      jfcharles
      Member

      Here is a version that works, but I really just tricked your own patch. What's happening in your most recent version is that when you are at "3" and hit the "increment" trigger, you first increment the counter, get the flag for "max value reached" then reset. The only thing I added is a connection from the reset trigger to the C_MERGE with the increment trigger in input (I added a 4th input). Seems to work. There must be more elegant versions – I hope someone will share!

      HEADM adc 2 2 iSwitchL-out iSwitchL-out Empty Empty 1 menupage-obj ;=0,0,100,0
      ISWITCH iSwitchL 4 SelectCounter-out adc-in1 adc-null adc-in1 adc-null ;=575,0,100,0
      C_MERGE resetCounter 2 SelectCounter-timeout reset-out ;=400,150,100,0
      STEXTKNOB SelectTextKnob %s select 4 0 SelectCounter-out "textknob: select 0" "textknob: select 1" "textknob: select 2" "textknob: select 3" ;=575,200,100,0
      C_MERGE incrementCounter 4 resetCounter-out SelectTextKnob-textnum_out increment-out reset-out ;=400,300,100,0
      C_COUNTER SelectCounter incrementCounter-out resetCounter-out 1 3 ;=575,325,100,0
      MENUPAGE menupage menupage menupage 5 increment-obj SelectTextKnob-obj counterMonitor-obj textKnobMonitor-obj reset-obj ;=950,125,100,0
      MONITOR counterMonitor SelectCounter-out "counter:         %1.0f" cntMonitor ;=800,325,100,0
      MONITOR textKnobMonitor SelectTextKnob-textnum_out textknobMon:%2.4f knobMonitor ;=800,200,100,0
      TRIGGER increment increment increment ;=100,550,100,0
      TRIGGER reset reset reset ;=250,550,100,0
      TAIL tail

      Jean-François.

    • #130809
      sean.e
      Participant

      Nice. I'm traveling this week so can't try it out yet.  Thanks.

    • #130827
      sean.e
      Participant

      Thanks – that clears up the reset.  Will continue working on the text problem and post as a separate thread.

    • #130828
      sean.e
      Participant

      I decided to punt on the STextKnob and use a TextTrigger instead (hence the other couple of posts regarding TextTriggers).  This is what I've ended up with:

      HEADM adc 2 2 iSwitchL-out iSwitchL-out Empty Empty 1 menupage-obj ;=0,25,100,0
      ISWITCH iSwitchL 4 SelectCounter-out adc-in1 adc-null adc-in1 adc-null ;=575,25,100,0
      C_MERGE resetCounter 2 SelectCounter-timeout reset-out ;=425,325,100,0
      TEXTTRIGGER texttrigger 4 SelectCounter-out "sel 0" "sel 1" "sel 2" "sel 3" ;=575,300,100,0
      C_MERGE incrementCounter 3 resetCounter-out texttrigger-out reset-out ;=425,175,100,0
      C_COUNTER SelectCounter incrementCounter-out resetCounter-out 1 3 ;=575,175,100,0
      MENUPAGE menupage menupage menupage 2 texttrigger-obj reset-obj ;=900,475,100,0
      TRIGGER reset reset reset ;=250,475,100,0

Viewing 5 reply threads
  • You must be logged in to reply to this topic.