LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cloning library and using it simultaneously in same vi

Hi,

Attached file contains my library for serial communication which is based on queued message handler.

 

Below is my issue.

I have a project where I have to communicate with multiple serial devices. I want to use this library for serial device communication.

Since there will be multiple serial device (it may be 2 or 25) and I cannot just create a copy of this library and place it in my vi.

Is there any alternative way to use this same library or is there a way where I can create a clone of this library and use it simultaneously for multiple devices. 

If my library needs modifications or changes, suggestions are welcome.


CLD Using LabVIEW since 2013
0 Kudos
Message 1 of 4
(1,148 Views)

@kartiknattar wrote:

If my library needs modifications or changes, suggestions are welcome.


For starters, all those communication VIs should be reentrant.

 

If you have 25 devices, 1 device's a call to a read, that might take seconds, will block all other device reads for that period. A normal (non-reentrant) VI will only execute ones at a time!

 

Usually, you'd make a VI that handles all communication, and start it 25 times. Either by putting 25 VIs in parallel, or start them dynamically, or put them in a parallel configured for loop. That Vi does also need to be reentrant.

0 Kudos
Message 2 of 4
(1,120 Views)

Any ways I found an alternative by creating a functional global variable for serial communication vis and placed it inside the library. I have to thoroughly check it now by calling it dynamically and making it reentrant.

I just have one doubt....

If there is a sub vi inside the reentrant vi, does that sub vi also needs to be reentrant??


CLD Using LabVIEW since 2013
0 Kudos
Message 3 of 4
(1,100 Views)

I just have one doubt....

> If there is a sub vi inside the reentrant vi, does that sub vi also needs to be reentrant??

 

If the sub vi operation does not depend on previous iterations then it should be OK without reentrancy.

But this does mean that only one of the dynamically launched vis can access it at a time.

This could be an issue if the sub vi is used a lot or takes significant time to execute.

 

steve

----------------------------------------------------------------------------------------------------------------
Founding (and only) member of AUITA - the Anti UI Thread Association.
----------------------------------------------------------------------------------------------------------------
Message 4 of 4
(1,060 Views)