LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reset button

Hi,
i would like to explain my problem here: whenever i press the start button, the No will increase by 1, and so on till i log out, the No result will store in my ini file and when next time i start test again, it will appear with the last previous No.
So, my problem here is how am i going to create a reset state to reset back the No back to 0 ?? Actually, i can do it in my ini file but i thinking another approach by using event structure, but how as i still not familiar with event structure or is there any other methods??
Attach with my test.jpg
 
regards,
Simon
 
 
0 Kudos
Message 1 of 14
(4,581 Views)

Try this method.

 

-Kumar.B

Message 2 of 14
(4,570 Views)

The above code draft will certainly work.

I am bit worried that your program is overly complicated. Here are a few points you might consider:

  1. If you set the loop to "stop if true" (right-click on the termination terminal), you don't need to constantly invert the logout boolean.
  2. The test button handles two case structures. Why can't you combine all code in one case structure? Same difference. 🙂
  3. A mechanical action "switch until released" acts like a doorbell and if you release it before the code has a chance to read the TRUE value, it will be missed. A better mechanical action for this is "latch when released". Now the button remains TRUE until it is read once by the code, at which time it resets to FALSE automatically.
  4. What determines how fast the big loop spins? How fast does it need to be?
  5. The inner loop is useless. Migrate the shift register to the outer loop and place only the +1 inside the case structure for example.
  6. Most likely one event structure with multiple cases can replace all these little case structures.
  7. Why do you think you need a stacked sequence structure?
  8. What's up with all these local variables? E.g. where else does boolean 3 get set that you need to reset it millions of times per second, every iteration?
  9. Same with the boolean 2 indicator. Why does it need to get set to TRUE over and over? Is it fighting with some other code that tries to set it to FALSE?

If you don't mind, you can attach your program. Maybe some of us will see some possible improvements. 🙂

Message 3 of 14
(4,559 Views)

Hi kumar,

Thanks for the suggestion, it's quite usefull.

Hi altenbach ,

Thanks for the response. I attach with my vi and see maybe can improve to get better performance.

regards,

Download All
0 Kudos
Message 4 of 14
(4,551 Views)
Simon,
 
Here are a few quick comments:
  • Frame 0 is a nightmare. You have controls and indicators that have the same label, making the use of local variables very dangerous. There is no data dependency, so you don't know what values the indicators will have. You have a 50/50 chance that they get the value from the control or from the subVI, depending on what parts execute first. LabVIEW does not necessarlily execute left to right, for example. This just screams "race condition"!
  • Don't use color box controls for decorations. Use decorations.
  • Use arrays and clusters for related values. You have way too many seperate wires and connectors.
  • You don't need any local variables. All hidden control can be eliminated.
  • You don't need a stacked sequence.
  • Use loops for repetitive work (see the modified read and write file VIs).
  • The boolean logic for multiple conditions is much simpler to understand if you use "stop if true".
  • Don't use string operations if all you later need is a numeric array.

Attached is a quick attempt at cleanup. Since I did not have the test subVIs, I created some dummies. Modify as needed. There are probably bugs, so test everything first. 🙂

Message Edited by altenbach on 09-05-2007 11:10 AM

Message 5 of 14
(4,511 Views)
Actually, the "NO" should probably be the number of times you started a test. So, do the following. 🙂
Message 6 of 14
(4,499 Views)
Hi altenbach,
 
Many many thanks for the help.
 
I have try the the test.vi, there's few bugs:
 
1) I would like to press the Test Button once, then all the tests will run automatically instead of press the Test Button continuously.
 
2) After all the tests complete or partially complete due to test fail (the stop on fail button activated),the indicator will shift from red to green (boolean 3 to 2) to inform user that time to change and put new test module. So, this is my intention why to put indicator boolean 2 and 3. Or any other suggestion??  
 
3) The Result indicator always show FAIL. So after one loop test, it cannot continue anymore except logout to reset again.
I am thinking of make 3 state indication where the final result show PASS or FAIL, when starting it show blank. Any idea how to make it??
 
4) The SEL ALL button no response and i correct it by edit the event handle.
 
Overall, it show better approach and less wire connection especially for the config write and read subvi.

 

The "NO" is to show how many pieces of test module being test that day or week don't care whether pass or fail. I can reset the "NO" and start to count again.    

 
I have a Question here: 
How to use decorations to show the color??
 
regards,
 
 
 
 
0 Kudos
Message 7 of 14
(4,475 Views)
Sure! My code was just a draft and I am not able to run and test because of missing subVIs. It is still buggier than an ant farm. 🙂
  1. OK, this should work now. I accidentally assigned the timeout event to the wrong event case. As you can see, if testing is in progress, the timeout is set to zero so the next test should execute automatically. Only after the testing ends, the timeout goes back to infinity.
  2. I added a wire to do that now. Please test. Maybe you can use a single boolean with one state green and one state red?
  3. Just set the output tunnel to TRUE in the event containing the reset as in the modification.
  4. Yes, I forgot to add the event handle for that control.

There are probably many more tweaks before it runs correctly, so modify as needed. Good luck! 🙂

To place a decoration, go to the decoration palette and place it where you want. Now use the coloring tool to change the color. You can also use the "reorder" tool to change the layering.

Message 8 of 14
(4,467 Views)
The bugs still there, it still need to press the test button continuously for next test..
The subvi only return the result either pass or fail, by simulation i can just wire up with true/false boolean, however i can attach my subvi but more stack sequences, loop, wire connection, subvi again..     I still learn to make it simplify...
 
 
 
0 Kudos
Message 9 of 14
(4,451 Views)


@simon76 wrote:
The bugs still there, it still need to press the test button continuously for next test..

Yes, the problem was with the boolean logic. The dialog boxes returned a TRUE, causing a stop condition. I stripped out all the special code, added an test indicator and a small wait to see the test progress. This demo should have the correct meachanics to run all tests unattended.. It should not need much to get it where you want it to go.. 🙂

 


 

Message 10 of 14
(4,422 Views)