02-01-2021 03:36 AM
I'm writing some code to monitor and control some lab equipment, and part of that is requiring the software to automatically register if something is wrong and act accordingly. The code will be continuously reading the status of the equipment via a DAQ card, with an overarching "Boolean Out" boolean will indicate whether the system is running as intended. So, I've written this as two separate loops, one to monitor the device status and another to control the equipment (with a state machine).
In terms of communicating between these two loops, I need to ensure that:
At the moment, I have got this working as intended with local variables in the "Task" case in the Timeout event, and the ""Task": Value Change" event to cover these two cases (see attached code). However, I'm not sure this is the best implementation as I don't want to overuse local variables. There would be a similar implementation in several different tasks, so it would be reading that "Boolean Out" boolean frequently.
Another method I've seen is using a single-element queue, but I don't know whether that would be overkill because you only need the current value of "Boolean Out".
Sorry, I suppose there isn't really a particular question here. I'm just wondering whether this is a suitable solution, if there's anything problematic about it, or an easy alternative which would work better?
Solved! Go to Solution.
02-02-2021 09:13 AM
Hello,
As I can see You tried to make it work in FPGA target, and used structures that not even exist in the pallet, I guess You copied it from somewhere. It is really interesting , how You make it work, it shouldn't even compile. Try to use correct tools for FPGA. And try to formulate Your question, You want a proper error handler?
Regards.
02-02-2021 10:05 AM - edited 02-02-2021 10:06 AM
Hi IDASYAN,
I'm afraid I'm not aware of what FPGA target is and if I've used some functionality of it, it was completely unintentional. I'm trying to figure out whether it's okay to read "Boolean Out" with a local variable in the second loop, or whether there's a better and/or safer way to stop and prevent a task from running.
02-02-2021 10:22 AM - edited 02-02-2021 10:23 AM
Hi,
Okay if so, could You please explain what exactly You want to do , and what is the hard You are using.
FPGA target tools can't be used accidentally, You need to open a special project for it, with special hard. They are really complex circuits, working on high speeds. Be sure You need it, there are special rules for them in LabVIEW programming.
It is okay to use that local variable, but I'm afraid Your application won't work at all.
If You would share the information I asked , we will be able to figure out the best option for You.
Regards.
02-02-2021 10:34 AM
I don't understand what I was unclear about in my first post. What I shared wasn't the full application, but a mock-up to demonstrate the functionality I was aiming for.
My application is working fine at the moment. I've tested it with the hardware (USB-6363 - NI) and there have been no problems interfacing with it. Where is the indication that I've been using FPGA target tools? I have no idea what they are and, if I understand you correctly, I couldn't have used them unintentionally. Everything I have used in the code I shared was from the basic functionality of LabVIEW 2018.
02-02-2021 10:57 AM
Okay, if everything is that simple, than the answer is Yes , it would work with local variables , but I'll recommend You use channel handlers for transfer data between loops , here is link , if You need more examples You will find them in LabVIEW help window.
Regards .