06-30-2016 10:55 AM
When ever I run this VI and the VISA resource is not set correctly it automatically throws and error
"Error -1073807346 occurred at VISA Open in Agilent 34401.lvlib:Initialize.vi->34401A DMM Monitor.vi"
My intent of the "Measure" Button is to use it as a "Start Button" so it doesn't throw the error as soon as a user runs the program when he/she has not even had an oppertunity to select a file or VISA resourse and at the same time I'd like to enable the while loop.
What would be the best way to go about this, should I use an event structure or conditional disable structure or some other method
Solved! Go to Solution.
06-30-2016 11:00 AM
06-30-2016 03:50 PM
I'm not sure how this event structure works I added an event but how do I tie the measure button into is so the program starts when the user hits measure?
07-01-2016 02:19 AM
@rr1024 wrote:I'm not sure how this event structure works I added an event but how do I tie the measure button into is so the program starts when the user hits measure?
Please go through state machine architecture and how to handle events
07-01-2016 09:56 AM
@PalanivelThiruvenkadam wrote:
@rr1024 wrote:I'm not sure how this event structure works I added an event but how do I tie the measure button into is so the program starts when the user hits measure?
Please go through state machine architecture and how to handle events
Fortunately I already know how a statemachine works and have years of creating them in C, C++, PHP, VBA, # ... languages and the examples on NI's website suck, do little more than show you the graphic with an explanation of what it does and no real step by step use.
From NI's silly examples I tried the following which doesn't do anything...lol
07-01-2016 10:00 AM
If you already know how a state machine works with other languages, then why are you asking us? It's pretty easy to see how it works just on the examples. Have you even used the Tutorials to help guide you?
07-01-2016 10:05 AM - edited 07-01-2016 10:07 AM
I am kind of old school and do not find much use for event structures but.... give this a try.
I am sure somene here that actually understand event based programming could do better.
Oh BTW: The timeout case is empty
07-01-2016 10:10 AM
07-01-2016 10:31 AM
RTSVLU,
Did you try running your VI? It won't work.
Your event case is set to lock the front panel until the even completes. You hit measure and the event case starts and the while loop starts. The event case won't finish until you stop the while loop by hitting the measure button again. You can't hit the measure button again because the front panel is locked.
A proper state machine would have in intialize, close, and a timeout for the event structure. No inner while loop in any case of the event structure.
07-01-2016 10:44 AM - edited 07-01-2016 10:45 AM
@RavensFan wrote:RTSVLU,
Did you try running your VI? It won't work.
Your event case is set to lock the front panel until the even completes. You hit measure and the event case starts and the while loop starts. The event case won't finish until you stop the while loop by hitting the measure button again. You can't hit the measure button again because the front panel is locked.
A proper state machine would have in intialize, close, and a timeout for the event structure. No inner while loop in any case of the event structure.
Nope, I did not.
Like I said I do not understand the event structure. I think I have used it maybe twice since it was added to LabVIEW.
I know what you are saying about a state machine, 99.999% of my programs are a state machine. But I really did not want to totally rewrite the vi since the whole thign is a kludge to begin with, might as well kludge in an event structure.
BUT you are correct this entire vi needs to be re written from the start using a state machine.