03-29-2019 09:09 AM - edited 03-29-2019 09:13 AM
03-29-2019 09:31 AM
Use a Value (Signalling) property node to write the data to rather than the indicator terminal if you want the case in the event structure to fire.
One problem with your code is that the event structure is in the loop and will hold up the execution of the loop until an event occurs. And in your case, you only have one event, the load settings value change. I doubt you want to fire a load settings change just to get the event structure to run and have the loop iterate again. You should probably have a timeout case on that event structure.
Something else I see is that you have an array that you have an Index Array with a lot of indices wired up to get some elements to just build into another array. The elements seem to be adjacent row 0 column 0 through row 0 column 6. Just use Array subset to get your new array with one function and a couple index constants.
03-29-2019 09:55 AM
Hi RavensFan,
Thank you for your reply.
Wouldn't it be easier to take the event structure out of the while loop?
03-29-2019 09:57 AM
Hi even91,
I would like to make a few basic remarks to your code:
- a state machine would be good for your program
Initialize your device(s)
event structure in idle case
read daqmx and include your comparisons to decide which state comes next, e.g. if your limit is exceeded do shutdown (your case 2)
and so on ...
- search for initialized and uninitialzed shift registers
- if you want to have a switch, use a switch, Load on/Power on
Regards,
MOJO
03-29-2019 10:34 AM
@even91 wrote:
Hi RavensFan,
Thank you for your reply.
Wouldn't it be easier to take the event structure out of the while loop?
No. What if you want to change the settings while the VI is running?
And if you took it out of the loop, and you had the event set lock front panel until event completes (which is the default setting), once it has run once and you are in the loop and press a load setting change again, you'll lock up your front panel cold because you'll never get to executing the event structure again to handle the event that was queued up. the event won't complete and the front panel remains locked.