12-21-2023 03:39 PM - edited 12-21-2023 04:12 PM
Hello everyone,
I'm facing a problem using a dynamic event.
My goal is to use a button on a VI (we'll call it the topLevel) that will trigger an event case on another VI (we'll call it the subVi).
In fact, the topLevel is my project's HMI. To avoid having too much code on this VI, I want to move part of it. One of these parts is measurement acquisition and archiving. The button allows me to launch archiving via a structe event combined with a machine state.
This project is implemented in a cRIO.
Before writing all the code, I tested it without using the cRIO by making two vi (topLevel and subVI). The program worked perfectly on my computer.
I then naturally copied the code to my project with the cRIO and it no longer worked. 😑
I get the following error when I run the project on cRIO:
Below the code inside the topLevel (HMI) :
Below the code inside the subVI (archiving) :
The error appears at the output of the "Reg Event" property node.
To begin with, my question is as follows: Why does the code work on my PC but crash with the cRIO? Is it a compability problem? ...
For information, I use LabView 2019 SP1.
Thank you in advance for your time and your help !
12-21-2023 05:05 PM
cRIOs, I believe, run a Real-Time Operating System, such as PharLap or NI Real-Time Linux. These operating systems run VIs without support for User Interfaces -- the Front Panel of a VI is just for the purpose of passing arguments in and out of the VI. Accordingly, there is no implementation of an Event Structure on a cRIO.
Do you have a Host program running on a PC connected to the cRIO? You can implement an Event Loop on the PC, and then pass the information into the cRIO using something like Network Streams (the cRIO would need to run a timed loop continually checking for a "Value Changed" property coming in on the designated Network Stream).
Bob Schor
12-21-2023 05:22 PM - edited 12-21-2023 05:25 PM
Hi Martin,
Unless your RT target has Embedded UI functionality, you cannot handle UI events in your event structures (User events are still usable though).
More infos on event structures with RT targets: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000004AV2SAM&l=en-US
If your target cannot have a UI, there is no way you can click on the button! You could argue that when you deploy the code from the project, you have access to the front panels of the VIs on the RT target. However, this is only a debug tool. With a proper RT exectuable, all front panels are removed from the VIs.
Regards,
Raphaël.
12-23-2023 05:56 AM - edited 12-23-2023 05:58 AM
Hello everyone,
Thank you very much for your answers.
In conclusion, the cRIO I own is not a compatible model for using UI events.
So I tried to make the same program with User Events, but that made it far too complicated.
So I went back to a simple solution: just have a topLevel with a while loop and a selec case with True or False to launch the code... Archaic but functional!
In any case, using User Events is quite possible, but it's necessary to have at least one loop that scans the VI buttons (yes, I won't make a proper RT executable without panel 😋).
Thank you very much!