07-12-2013 10:38 AM
Hi, I am trying to transfer case structures that are currently set up to a control that if on prompt the user where to save and then save all following files to that location till end of program and if off the do nothing. I would like to enable these to be switched on and off at any point and know to use an event structure. The problem is I am new to coding with an event structure and have been able to get the button to work but not continuously save. I attached a screen shot of the original case structure and was wondering if someone could show me how to change it to the event structure format with the same functionality. I'm getting a little lost and confused. Thanks!
07-12-2013 10:41 AM - edited 07-12-2013 10:41 AM
Please attach a simplified VI. A gigantic picture showing only a sliver of an event structure is not useful to describe the problem.
07-12-2013 10:46 AM - edited 07-12-2013 10:48 AM
By the way, you should try to follow the unwritten rule of keeping each VI within a single screen. [Yes, there are varing monitor sizes/resolutions. You should just be reasonable about it]. Or, at the very least, keep it such that it only needs scrolled in one direciton -- veritcal or horizontal. Having it extend in all four cardinal directions will be nearly impossible to manage and will be impossible for anyone else to easily read/follow.
You can create subVIs for large segments of code - especially if it is reusable code. You can highlight any segment of code and go to the "Edit" tab and select "Create SubVI". Read more here.
07-12-2013 11:04 AM
I was given this code from another person and have since been trying to achive that. Also for the screan shot the 'sliver' of the event structure that you see does not pertain to my question. What I am interested in was the now highlighted in red case structures being turned into event structures with the previously mentioned functionality.
07-12-2013 11:18 AM - edited 07-12-2013 11:21 AM
It is a really bad idea to bury event structures deep inside sequences. Event structures should be in a toplevel loop and always ready to react. I don't understand your question.
This entire thing needs to be recoded as a proper state machine instead.
07-12-2013 11:26 AM
I am fairly new to this style of coding (only been at it for a few months) can you give me some examples of how to do that or write the logic out a little? I know a state machine is a while loop with a case structure inside but I am just worried that something will get messed up with the other functionalities of the program if I try to recreate this.
07-12-2013 12:34 PM
Could really use some help on this please.
07-12-2013 12:47 PM
Since these buttons are polled anyway, an event structure seems incorrect for this scenario. It is too difficult to give more detailed advice by just looking at an image of a code fragment.
07-12-2013 02:14 PM - edited 07-12-2013 02:14 PM
I can't attach the vi due to the size and I do not think a simplified piece of code is going to help. I did however go through and stitch two jpegs together of the main two sequences. hopefully this gives a better idea of what I am trying to do and where to go from here. thank you.
07-12-2013 06:13 PM
Any ideas would be extremely helpful. Thanks.