LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to communicate DATA between multiple state machines.

Solved!
Go to solution

Hi I'm doing a project that needs to acquire data from a simulated data file and show it on a GUI. Both of them are made in a state machine. I'm wondering if there is a good way to communicate data between two state machines? It would be very much appreciated if you can provide with some examples. Thanks a lot.

0 Kudos
Message 1 of 7
(4,019 Views)

Hi Xinghe,

 

what is a "simulated file"? 😄

 

There are several ways to communicate between parallel loops. All of them are explained in the LabVIEW help!

(queues, notifier, globals, locals, shared variables, DVR, AE aka FGV, …)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(4,011 Views)
Solution
Accepted by topic author Xinghe.W

Ok, there are lots of ways to communicate, but are these state machines in the same project? Same VI? All in LabVIEW?

I like functional global variables due to the functionality that can be included in them. If they are used wrong, like most things when coding, you will create races and break your code.

Local variable work, but I try to stear clear of them when possible. If they are used wrong, like most things when coding, you will create races and break your code.

Queues are pretty popular for communicating, but try to stay with fixed size data if you think memory limits might be a problem.

If you are talking across a network look into Network Published Shared Variables (don't use these unless you have a stable network,) Network Streams, TCP/IP, UDP,  or Web Services (you need experience in this arena. It doesn't just fall together.

LabVIEW is a good way to program, but this kind of touches the available options.

Glad to answer questions. Thanks for any KUDOS or marked solutions 😉
Message 3 of 7
(4,005 Views)

Thank you for your reply. The simulated data is the data saved from the equipment, and I want to test the GUI by that data first before I go to DLL. I know how to communicate data by queue, but how should I use queue to communicate between two state machines that located in their Sub-VIs?

0 Kudos
Message 4 of 7
(4,003 Views)

The state machines are in the same project. Is there any tutorial or examples available to use queue funciton between state machines in the same project?

0 Kudos
Message 5 of 7
(3,997 Views)

Check these:

http://www.ni.com/tutorials/

Are you a subscriber and have the training available in your account?

Glad to answer questions. Thanks for any KUDOS or marked solutions 😉
Message 6 of 7
(3,971 Views)
Solution
Accepted by topic author Xinghe.W

Thanks! I found this that is very helpful: 

https://decibel.ni.com/content/docs/DOC-41133

0 Kudos
Message 7 of 7
(3,962 Views)