LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with using forward and backward buttons to display x-axis graph intervals of a .wav file.

    I am experiencing several problem using forward and backward increment buttons in an event structure to display sequential sections of the graph of a .wav input file.  The intervals to dislay are based on an Array Subset vi with starting location index based on the while loops i, and the lenth of each interval based on the number of sample points per interval.  A forward button steps thru the intervals of the graph.  For example, if I set it to 3 second intervals, hitting the button will display 0 to 3, 3 to 6, and 6-9 second portions of a graph for a nine second input file.  This worked fine until I added a backward buton to go back to allow the option to go back and view a previous interval.  For example, If I have the 6 to 9 second portion of the graph displayed, I then may want to go back and display the 3 to 6 portion of the graph. 
      I am encountering several problems.  One is: how do I set the starting points for this interval since the i isn't simply being icremented upon each button press?  going backwards adds iterations to the loop so that I cant simply rely on using i alone other wise I get the wrong starting point of the next section to display.  Maybe I need to use an array? 
      Another problem is that i is being increased by two units after each button press.  Another issue it that the buttons only work every other time they are pressed.  this happens even while they are set to "latch when pressed".  but they dont seem to reset to false when done because when I close and reopen the program the buttons may not work on the first press, but work on the second press and then everyother press.  That is, the buttons (including the stop button) only get set to true upon clicking them everyother time they are pressed.     
 
Checker.     
0 Kudos
Message 1 of 2
(2,665 Views)

A couple ideas.  First stop using the i as your counter.  Instead use a shift register, and everytime you increment add one to the value, and everytime you decrement subtract 1.  That way the value in the shift register will always be what you need it to be.

As far as the 2 event I am not exactly sure, but do you have the controls terminals inside the events.  For example, make sure the decrement button is inside the decrement value changed event.

If that doesn't help post your VI and we can look at it.

0 Kudos
Message 2 of 2
(2,656 Views)