Discussion:
event structure help, basic execution
(too old to reply)
Newbie217
2008-08-15 23:10:05 UTC
Permalink
Hello, I am a new user of the event structure and have a very basic question. I am trying to write a program to control some GPIB power supplies that executes intial user settings (voltage, current limit, etc.) a single instance before stepping into an event structure.  Once inside the event structure, the timeout event will be infinite, and the program will only update when there is a change to any of the front panel controls. The problem with my current approach is that I am rewriting the same code twice. Once, before stepping into the event structure, and a second time when the user front panel controls change. Is there a way to incorporate the initial code to execute only a single time in the event structure shell? If so, how do I go about doing that? I don't want to put it in the timeout event because I would like to avoid having the program refresh itself unless a front panel control changes. But I do need that single intial execution. Any help is appreciated. Thanks!
altenbach
2008-08-15 23:10:06 UTC
Permalink
You can do one of the following teachinques: - First create an event for your main value changes and also assing the timeout to it. - Place the timeout in a shift register initialized with zero and wire -a (=infinite) to the shift regsiter on the right. It will timeoutonce and then never again.
- Use "Select" and wire =0 to the iteration terminal. Pick 0 for i=0 and -1 otherwise and wire the output to the timout terminal of the event structure.

- Don't even use a timeout event, but use a value(sgnl) property write before the loop to trigger the main event with it. This way it will fire immediately after the event structure is ready for the first time. As a side effect, you can even bring the control to a defined state.
 See how far you get.
Eugen Graf
2008-08-15 23:40:17 UTC
Permalink
 Place your whole initialisation step into a SubVI and call them before the event structure and even in the appropriate event case.
Continue reading on narkive:
Loading...