I am developing a program for the cRIO-9053 in which I'm trying to collect data from multiple inverters over Modbus in a timed loop. When I do all of it in the top-level VI it works perfectly, but to make it cleaner and more modular I want to encapsulate each of these data collection loops in a subVI. Since these subVIs are meant to run indefinitely I'm trying to use asynchronous call-and-forget calls to keep them from blocking the rest of the program from executing, but when I try to make multiple calls, only one seems to be executing and I'm not sure what the problem is. This is the code I'm using to make the asynchronous calls:
The one subVI feeding into the async subVI just initializes an RT FIFO and some other variables to be able to route commands back to the inverter loops and likewise the two wires coming in from the top are references to user events that contain RT FIFOs to get the data out of the loops. I'm able to send and receive data to and from the first Modbus server that I'm using for testing just fine, but not the second one for some reason. Any help on getting this working would be appreciated as I'm pretty new to Labview.
Solved! Go to Solution.
Thank you, I didn't realize I had to change that setting to get reentrant execution. I tried it with and without the x40 flag and both work; it looks like the flag is only needed when you use the same VI reference for all instances of the subVI like so:
Do you know if there's any performance difference between doing it this way vs. having separate references for each call?
For your use case, I don't think you will notice a difference.
If you had some persistent memory (think uninitialized shift registers, or feedback nodes) and you were calling the SubVIs over and over, then you would want a separate reference for each one.