From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
07-29-2015 12:06 PM
Hi Folks.
In the attached VI the code in the "Save Data" state is getting implemented over and over in a loop, whereas it should only get executed only once and then go back to the "Wait for Start" state and wait for button press. When the program enters the "Save Data" state the data is written to the spreadsheet until I stop the program. Why is this happening and how do I stop it?
Thanks,
Mark.
07-29-2015 12:21 PM
What is the default value for the enum that you have not included? (i.e. what value comes out of the timeout case of the inner event structure?)
07-29-2015 12:30 PM
The timeout of the inner event structure is empty. Should it be populated?
07-29-2015 01:00 PM
Yes, and the output tunnel for the state is unwired, meaning you get the default value of the state enum, which is "Save data". Thus this state executes whenever 100ms have passed and no otter event got triggered. What else do you expect?
Why is your diagram so big? I cannot effectively look at it on my laptop.
07-29-2015 01:05 PM
Let me offer two tips that could help cleanup some code.
1. The compound arithemetic node. You can set it for AND mode, and expand it for as many inputs as necessary. The you won't need all of the individual binary AND functions you have to combine multiple boolean values. The AND Array Elements might also be useful.
2. Index array automatically increments the indices as you go down the list. So you don't need i-1, i, i+1, i+2, ... Just wire the i-1 into the top terminal, then by default, each terminal below that will be the successive indices. Now you've eliminated a dozen other wires and half dozen math nodes.
07-30-2015 03:40 AM
altenbach. I put the "wait for start" state in the timeout case which did the trick. Why is save "save data" the default when "wait for start" is set as default.
I know my diagram is large, apologies. I will start to reduce it. But when I make changes it just gets bigger.
07-30-2015 03:41 AM
Ravensfan. Thanks for the tips. I will start tidying this up when I get everything working.
07-30-2015 04:37 AM
The default case means 'use this case if none of the case values match the selector value'. However, the value from the wire DOES match a case- the save case. The default value returned from an unwired node is a totally separate concept from the default case. The default value from the node is the 'zero value'. I assume SAVE is the first enumerated value in your enum.