LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Globals

I apoligize for the ignorance but can someone give me an example of implementing a state machine that solves this problem.

 

I tried various things to get around the wait associated with the GPS data rates but have only solved the problem with the global.  However,  I welcome a little more knowledge surrounding a state machine.  Have read a little about them but have not tried to build one and, in fact, am a little in the dark as to getting started.  

0 Kudos
Message 11 of 22
(1,389 Views)

irfocus wrote:

I apoligize for the ignorance but can someone give me an example of implementing a state machine that solves this problem.

 

I tried various things to get around the wait associated with the GPS data rates but have only solved the problem with the global.  However,  I welcome a little more knowledge surrounding a state machine.  Have read a little about them but have not tried to build one and, in fact, am a little in the dark as to getting started.  


Well you have come to the right place but first a litle background about all of these people that have been helping out. Most of the contributors to this forum are NOT NI employees (they have bluish bars under thier names). They are all volunteers who (for the most part) have a real job which has nothing to do with answering Qs. So to get something out this forum you are going to have to carry the lions share of the so...

 

Post code and images of what you have tried and detail where you get stuck. Most of the frequent flyers can help you by giving hints or pointing at other threads.

 

So show us were you have trouble and let community show you the direction.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 12 of 22
(1,383 Views)

Ben (and others) has taught me a ton about event driven state machines...I have been working on a little example using a stopwatch as a design target.  It uses a type definition for all the variables and controls...it uses a state machine for all the functions...and has a little error recovery thingy ... all the event>state conversion are done using a queue and there is an error queue too.

 

The project is attached...and is not in "final" form...just good enough to work.

 

The basic outline was created by using "file>New>" and then selecting the event driven state machine outline.  I added the error handling queue so I could do all that in one place.  I'm still struggeling with the windows interfaces for the instruments and any suggesions on how to update the instruments in a way other than using value signaling spread all over the place would be welcome.

 

Good luck.

 

 

Hummer1

Message 13 of 22
(1,369 Views)

Thank you Hummer.

 

I know, what a pain in the XXXX.  Would it be possible to save this to an 8.5 file.  I can't read your 9.0.

 

 

0 Kudos
Message 14 of 22
(1,350 Views)

I'm not sure how to do that...but will attack it and see what happens.

 

Do you just make a copy of the vi...and then save as under a different format?

0 Kudos
Message 15 of 22
(1,341 Views)

Hummer1 wrote:

I'm not sure how to do that...but will attack it and see what happens.

 

Do you just make a copy of the vi...and then save as under a different format?


Do a File->Save for previous version.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 16 of 22
(1,338 Views)
Try this in the mean time...here is a snippet...
0 Kudos
Message 17 of 22
(1,337 Views)
Snippets will only work with LV 2009. See my post above about saving for previous version.


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 18 of 22
(1,334 Views)

I can't do it from here.

There is a known issue with LV 2009...you can save to version 8.6...but not to 8.5.  The work around is to save to 8.6...open 8.6 and then save to 8.5. (per forum discussion.)

 

I don't have 8.6 on my machine any more but would welcome someone trying this flip for us...

 

Thanks in advance...

 

Hummer1

 

0 Kudos
Message 19 of 22
(1,331 Views)

Hi irfocus,

 

Let me try to clarify things a little.

 

There are two suggestions being offered to make your code better while also offering ideas to help with your delay.

 

1) more than one of us mentioned the timeout for the VISA functions since once they are started they do not retun until the timeout is reached. To check this watch your code in executio highlighting mode to see if the read is active when the shutdown is intitiated and verify when the timeout compltes, the app shuts down. watching it in execution highlighting mode can alos give you a hint as to when your shutdown is detected by teh sub-VI.

 

2) Action Engines were mentioned to give you a way of sharing data between threads that is not subject to race conditions. If the whole probelm is the T.O then this is just an FYI. If that global you are using is part of race condition, then AE's are a good way to fix that.

 

3) State Machines are another good programming suggestion and are wonderful for any code construct that is more complicated than a simple loop. They are much prefered over a seq structure because there order can be easily changed and the can lopp back on themselves if warrented.

 

So...

 

Start with watching your code in execution highlighting mode and figure out...

 

A) Is the subVI failing to see the stop (maybe race condition, or not being checked in an inner loop)

 

B) Is the sub-VI stuck in a VISA function and therefore is not checking for the stop.

 

Trying my best to help (and still keep my day job),

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 20 of 22
(1,301 Views)