06-29-2022 12:54 PM
Hi,
I am working on a state machine for communication via myRIO, I have started from the "simple state machine" template available in Labview where I currently only have initialize, wait for event and stop as events. However, it does not stop when it should stop, when I press stop the idea is that it should go into the Stop case. but it does not, however, when I move all VIs and states.ctl to the computer via project toolbar it stops when it should. See picture:
Does anyone know where I am going wrong?
Solved! Go to Solution.
06-29-2022 01:02 PM
Hi Antje,
@antje668 wrote:
Does anyone know where I am going wrong?
Yes.
Did you read the comments in the block diagram of your mainVI?
Especially those of the event structure?
There it says:
Use an Event Structure to monitor the user interface
Now the surprise: your myRIO doesn't offer any user interface (aka GUI)!
When there is no GUI, then there are no events related to UI elements!
Infact most RIO devices are considered "headless", which means they don't offer or support a GUI. And so they don't support the event structure with all their functionality as a regular Windows computer target does…
When you are looking for examples then you should use File->New… and select one of those examples for RIO devices (aka Realtime projects)!
06-29-2022 01:16 PM
Hello GerdW,
Thank you are a fast and informative answer.
Is it any way where I can get around this problem maybe or should I just stick to the templates you recommended? Cause I do need to have a user interface where the states changes depending on which button the user press on the UI.
For example I want to be able to switch between configure data, acquire data, reset data, stop and so on.
06-29-2022 01:28 PM
Hi Antje,
when you want to handle several targets within your project (Windows computer + myRIO), then you should start with a RealTime project.
In those example projects it is explained how to handle a GUI on your Windows computer together with a RIO target doing the "statemachine stuff"…
06-29-2022 01:51 PM
Maybe this is exactly what I'm looking for? (See attached picture)
06-29-2022 02:36 PM
Hi Antje,
@antje668 wrote:
Maybe this is exactly what I'm looking for?
Yes, start with this example and learn from it...
06-30-2022 11:26 AM
Hi Gerdw,
I have another perhaps stupid question. Do the VIs called "host" and "target" have to run at the same time?
The "host" can be seen as the UI, so anything I press or parameters specified are sent for appropriate action to myRIO.
My interpretation at first was that only the "host" located on the PC needed to be run, then the PC and myRIO communicate via shared variable. But I'm starting to wonder if both VIs need to run after all.
I have attached the project and a picture of the tree structure.
I have used the template for RT state machine that we talked about yesterday.
06-30-2022 02:16 PM
Hi Antje,
@antje668 wrote:
I have another perhaps stupid question. Do the VIs called "host" and "target" have to run at the same time?
The "host" can be seen as the UI, so anything I press or parameters specified are sent for appropriate action to myRIO.
My interpretation at first was that only the "host" located on the PC needed to be run, then the PC and myRIO communicate via shared variable. But I'm starting to wonder if both VIs need to run after all.
There are no stupid questions, but only stupid answers…
Yes, they both need to run at the same time!
You need to keep in mind: your Windows computer and the myRIO are two (2) computers on their own!
So when you want to send data from host to target then it's not sufficient to only run the host transmitter, there also needs to run a target receiver…
07-02-2022 10:01 AM
Hello, Antje.
Welcome to the "interesting world" of LabVIEW Real-Time. Before worrying about the complexities of managing two computers running at the same time and needing to communicate with each other and exchange data between themselves, it would be a good idea to have spent a few months (or years?) getting some level of expertise in LabVIEW, itself. You should be able to:
When you start dealing with a LabVIEW Real-Time Project, you are necessarily dealing with two computers, the Host PC and the LabVIEW Real-Time Target, running two Operating Systems (typically Windows and NI Real-Time Linux), and potentially running two independent LabVIEW programs. It is possible to write a LabVIEW RT Project that only has a Real-Time component, but then you need to figure out how to communicate with it, including how to start and stop it.
Communication with Real-Time Targets are usually done through TCP/IP channels. In the few such routines I've developed, I have use LabVIEW's Network Streams routines to set up Host/Target two-way communications. While in Development mode, the LabVIEW Project uses TCP/IP to allow you to deploy and test your LabVIEW RT Code on the attached Target.
Bob Schor