Reentrance in ansynchronously called Vis

Hi all,
Recently I've developed an application that heavily utilizes a single GPIB communication SubVI, which writes a query and reads answers from a single device. In order to avoid collisions, I have deliberately set this VI as non-reentrant.
This SubVI is called by another VI, of course.
Now please consider this situation: what i run multiple instances of the caller asynchronously? Will the non-reentrance policy be respected? 
I have hard times debugging the monstrosity I have created and I suspect I deal with collisions here. 
Please share your thoughts. Thank you.
EDIT: I'd appreciate if anyone would also share a method of checking whether the GPIB instrument (namely Agilent ENA) is ready for query. I'd implement this mechanism just to be sure the non-reentrance is respected.
Solved!
Go to Solution.

Dear McTom,
Yes, when you call a non-reentrant VI anywhere in your code, even in asynchronous calls, only one copy will exist, so all other calls to that function will have to wait their turn until the current call finishes executing.
If you need a more sophisticated approach, allow me to suggest migrating your GPIB communication to another loop. You can create a queue to send requests to this loop, and pass the queue reference to all asynchronous calls. This way, you have the ability to closely monitor the loop status (number of elements in the queue, current element, status) as well as some advanced queue handling (priority messages, flush queue).
Kind regards:
Andrew Valko
National Instruments Hungary

Similar Messages

  • Path to Executable from Dynamicall​y called VIs

    QUESTION: How can I retrieve the path to an executable that is called from a VI that was created by dynamically loading a VI template?
    The application is a bit too complicated to post, so I will try to describe...
    I have a built executable. It dynamically calls VITs that are insides LLBs and executes them. Because they are dynamically called from a VIT, the VI loaded into memory this way is only a copy of the VIT on disk - there is no path information to the loaded VI. This all works fine.
    I would like to programmatically get a path to the calling executable from within one of these dynamically called VIs (or one of their subVIs). I have so far been unsuccessful.
    Call Chain only gives the names of the callers. I couldnt' find a way to get the path info to the EXE from just the name.
    The VI property "Caller's Paths" gives me an empty array of paths
    Constant paths are unacceptable - I need these modules to figure out the absolute path to data support folders of the calling executable. Not only will they be called by different executables at different times, any one of those executables may be in a different locatin depending on how/where it's deployed, i.e., all over the danged place!
    Any answer is appreciated, even if it's "no way, not going to happen"
    Thanks in advance!

    You need two application properties:
    Application.Directory Path and Application.Name
    Together they will form the total path of the calling executable
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • What is the interaction between calling VIs and subVIs using VI Server?

    I'm studying for the CLAD and one of the lines in NI's preparation document here is this:
    What is the interaction between calling VIs and subVIs using VI Server?
    I know how to use the "Call By Reference" function to call a VI, but not necessarily a subVI. I thought a subVI is always loaded with the calling VI and has nothing to do with VI Server. What am I missing?
    Solved!
    Go to Solution.

    Hi Bmihura,
    I think this article will clear up how the VI Server works with subVIs called dynamically or statically.
    Calling a VI by Reference
    Best Regards,

  • Problems calling VIs remotely with RT-engine

    I have problems when I call VIs remotely and I create executables to run with the Run Time Engine 7.0.
    My program consists of a server that show some data (to the user) calling a VI that store such data. Another independent part of the program call such VI (which store the data) by remotely calling it with the VI Server. If I run the 2 programs under Labview 7.0 (directly installed) all goes well, but when I create the 2 executables and I run them, the data appeare only in the server. In the client I don't see any data even if I have no error detected.
    In the past I used the same methodology with Labview 5.1 in some application and I never had such problem.
    Could someone help me ?
    Thanks in advance.
    Linus

    I send you (as attachment) a llb with 3 VIs (Labview 7.0) : a server VI that call directly the message VI, and a client VI that call the message VI indirectly.
    I have compiled the server VI into an exe program (using the option that create the data.llb file).
    After installing that program (in the directory C:\programmi\Test\ ) and running it (with the Run Time Engine), if now I run the client VI (in the same machine) the value of the message displayed by the panel is not the same of the server.
    If I also compile the client VI into an exe program and then I run it (with the Run Time Engine), I obtain the same result (different values displayed).
    Only if I run the server VI and the client VI directly under Labview (in the same machine) the two VIs
    display the same message.
    If I also run the compiled exe version of the server VI and the client VI in two different machines I obtain the same message displayed.
    Best regads,
    Linus
    Attachments:
    Test.llb ‏51 KB

  • Non reentrancy for TCP/IP VIs.

    I am trying to write a server program that caters to multiple clients. The clients are being made to wait in turn when the data has to be sent back to them. The requests from client are handled by the server pretty
    much in the desired multi threaded fashion.
    Is it that the every instance that is spawned by the server to handle a particular client request(this is done using reentrancy) is rendered useless because tcp/ip VIs are not re-entrant .Please assist me in correcting my understanding. Also suggest me how to make the server actually catering to multiple clients if tcp/ip VIs are actually a limitation.
    Calling LabviewGuru(s) to help.

    sumitrishi wrote:
    > I am trying to write a server program that caters to multiple clients.
    > The clients are being made to wait in turn when the data has to be
    > sent back to them. The requests from client are handled by the server
    > pretty
    > much in the desired multi threaded fashion.
    > Is it that the every instance that is spawned by the server to handle
    > a particular client request(this is done using reentrancy) is rendered
    > useless because tcp/ip VIs are not re-entrant.
    Are you sure you see trouble at the TCP Read and TCP Write level? As far
    as I can say, they are highly asynchronous and do not block other
    instances of VIs calling them as well, at least for different refnums.
    Which version of LabVIEW are you using?
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Open DeviceNet interface error when TestStand call VIs of NI PCI-8532

    Hello,
    We use NI PCI-8532 was used as DeviceNet master to do functionality test with a slave (AC Drive).
    But when open DeviceNet interface, it happen the error.
    We can't find the solution and hope to find help from you.
    The basic sequence in TestStand is:
    1). Call "Open DeviceNet Interface.vi" to open interface and creat interface object.
         Interface(master) setting: interface name=dnet0, MAC ID=0, baudrate=125000bps
    2). Call "Open DeviceNet IO.vi" to creat DeviceNet IO object.
         Device(slave) setting: MAC ID=63
    3). Call "Operate DeviceNet Interface.vi" and operation code=start
    4). Call "Wait For State.vi"
    5). Call "Read DeviceNet IO.vi" to read data from IO object
    6). Call "Close Object.vi" to close IO object handle
    7). Call "Close Object.vi" to close interface object handle
    Remark, these DeviceNet VIs locates at "C:\Program Files\National Instruments\LabVIEW 2012\vi.lib\DeviceNet\VIAPI".
    First time to run sequece in TestStand, it can pass to run step 1) to open DeviceNet interface.
    But once there is some error with these steps, and it will happen "Open DeviceNet Interface" error (error code=0xBFF62006) when run these steps again.
    Then even use LabVIEW DeviceNet example to test, and it happen the same error except restart computer.
    The DeviceNet example locates at "C:\Program Files\National Instruments\LabVIEW 2012\examples\NI-Industrial Communications for DeviceNet\Basic Examples\PXI & PCI\MixedCommunication.vi".
    Some information more:
    PC operate system: Windows XP SP3
    LabVIEW version: 2012 SP1
    TestStand version: 2012 SP1
    PCI 8532 driver version: 2.3.0
    Other installed PCI board: PCI 8531 CANOpen

    The following errors may be resolved by resetting the CAN, DeviceNET or LIN device:
    Error -1074388986 occurred at ...
    NI-CAN:  (Hex 0xBFF62006) The object is already open in another application.  Solutions: Ensure that only one application at a time uses an object , and that you close all objects prior to exiting your application (don't use LabVIEW toolbar's Abort button).
    Error -1074388969 occurred at ...
    NI-CAN: (Hex 0xBFF62017) This attribute's value must be provided prior to the Open. Solutions: Set the attribute using the Config function before the Open, and do not set the attribute at any later time; Do not configure multiple CAN Objects for the same ID.
    SO,you should reset the DeviceNet.
    And another similar issue can explain some points of your problem  http://digital.ni.com/public.nsf/allkb/7D9383E9BEAD0B21862571640002F687?OpenDocument

  • Project conflict with dynamicall​y called VIs

       I have a largish project in LV 2010 in XP and W7.  It's all in a project, as I build the main VI into an .exe.  There are numerous other top-level VI's that are called dynamically.  I use source code distributions to build them with their diagrams removed.  The .exe then calls them from a directory similar to "C:\DMT\My Project\Utilities".  (I never did find a good utility for discovering user directories across XP, W7, etc., so we ended up right in C: for config files and support files, stuff that often used to get put in with the .exe in XP and earlier OS's.)
       Besides the top-level VI's, I also have a set of VI's that can be called dynamically to do custom calculations.  The interface to each VI is simple and defined, so users with LV can create their own calculations, put their VI (and sub-vis) in "C:\DMT\My Project\Calculations", and my program can make a call to it.
       My problem is in how the project handles these VIs.  I need to include them in the project, since I need source code distribution builds to assemble a directory of the VI and all its dependencies.  So the actual source is in one place (under SVN), then I build them to another location, which I then deploy to "C:\DMT\My Project\Calculations".  The problem is, if I run the main program from within the project (rather than as an .exe), it links up to these calculations in "C:\DMT\My Project\Calculations" and then the project has conflicts.  The Calculation VI's in the project are now trying to point to "C:\DMT\My Project\Calculations" (which isn't in SVN) instead of to the true source code.  Every time I run the program from the project, I have to remember to go and manually fix the project.
       Sorry if that's a bit complex to describe.  But does anyone have suggestions on an alternate architecture that would eliminate this issue?
    Thanks,
       DaveT
    David Thomson Original Code Consulting
    www.originalcode.com
    National Instruments Alliance Program Member
    Certified LabVIEW Architect
    There are 10 kinds of people: those who understand binary, and those who don't.
    Solved!
    Go to Solution.

    Thanks!  I'll try that.  (Wondering why I didn't think of that...)
    David Thomson Original Code Consulting
    www.originalcode.com
    National Instruments Alliance Program Member
    Certified LabVIEW Architect
    There are 10 kinds of people: those who understand binary, and those who don't.

  • How can i know the data that labview takes when calls visa read?????????????

    First sorry for my english!
    I have a program in wich i read data trough USB(in bulk mode) from a FIFO(from a microprocesor) . I don´t know if when i do a visa read and the program that is running in my microprocessor is waiting for the FIFO full, what data catch the visa read?, because labview don´t wait, always take data when visa read is call!!
    THANKS THANKS......

    A read operation just retrieves the bytes that are available on the serial port. Means that these bytes are there because they have already been sent by the connected device. They may be remains from a previous communication.
    Your protocol should ensure that
    1/ the serial buffer is empty before your start your communication session.
    2/ you read either a specified number of bytes, or all the incoming bytes, using a timeout in case of failure
    3/ you leave things clean after communication (empty buffer, close port...).
    Try to be e more specific if you need further help.
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • What are the differences between VISA and the old serial calls in regard to device communication?

    Recently, I had to communicate with a piece of equipment, (a Yokogawa UM-330 Green Series Digital indicator). The device was configured to communicate using RS-485 protocol. I purchased a RS-485 to RS-232 converter in order to communicate with the device via COM 1 on my PC. When I attempted communication in Max, using VISA read and write commands, I could not get the device to communicate. I even attempted writing a stand-alone VI to establish communication. Still, no-dice. Finally, I resorted to using the old serial call VIs. This made the device jump up and say hello. What I really would like to know is, has anyone experienced problems like this when
    attempting to communicate via seral with other devices using VISA, and if they have, what are the reasons for these problems? Is the problem specific to devices using RS-485? Or is the problem more device-specific?

    We have been using serial devices for more than ten years (proprietary acquisition cards and third party devices) using a variety of languages (BASIC, CVI, LabView...). I always found that the main problem are correct configuration of the serial port and cabling: once these items are correct, it's easy to obtain some reply from your devices (maybe not so easy to obtain the CORRECT reply or to interpret it...).
    I've used both old style VIs (vith LV 5) and VISA with success on the same devices: still I am a little confused about VISA. Maybe would be better some explanatory document by NI about VISA and serial communication.
    Anyway, my approach is at present: don't bother about control panel and/or MAX configuration of the port: open the device and configure i
    t as you need at the beginning of your application.
    Next use simple VISA Write and VISA Read VIs.
    Be sure to set the correct timeout: some devices are extremely long in replying (for example: an Infratek wattmeter takes as long as 45 seconds to send measures if you ask to it an harmonic analysis...!).
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How do I call the subvi in parallel with main VI. Main vi should not wait for the subvi

    I have a subvi which takes the parameters like port name, transmit rate, message to transmit over serial port and Start/stop flag. This subvi calls VISA write vi in a loop continuously, till the Start/Stop flag is false, to write a message to serial port at a mentioned transmit rate. This subvi will be called from another VI. Actual intension is to transmit different messages to different ports continuously and stop them when required. In this senario, please provide solution for below points:
    1. How do I call the subvi in parallel with main VI. Main vi should not wait for the subvi.
    2. How does main vi can control already running subvi in parallel to it. In the above example I would like to start the subvi from main vi when start\stop flag is true and would like to stop it when the flag is false.
    3. How do I call the subVI with one set of parameters from main vi, when same subVI is running with other set of parameters already from main vi(subvi being called in a case with different set of parameters each time when the case is called). Means, how do I keep track of reentrant subvi (different calls to same vi)from the same main vi.

    Hi Dharani24,
    Try if these are helpful,
    http://digital.ni.com/public.nsf/allkb/DB92C44E7D4D8A1B862577CB007D9C45
    http://zone.ni.com/reference/en-XX/help/371361J-01/lvconcepts/asynchronous_vi_calls/
    http://zone.ni.com/reference/en-XX/help/371361J-01/lvconcepts/reentrancy/
    Thanks
    uday,
    Please Mark the solution as accepted if your problem is solved and help author by clicking on kudoes
    Certified LabVIEW Associate Developer (CLAD) Using LV13

  • BlackBerry World not accepting VISA card -- follow up to my previous post

    Re purchase of an app for new Z10 --  main software all successfully updated to most recent.  Well, I posted last time about being escalated up through the ranks of BlackBerry software helpers from Bell, and after several levels getting a very easy-to-communicate-with woman from BlackBerry in Halifax, NS...
    She told me Bell would bill me for the apps on my carrier bill, and I told her No, they told me they didn't do that, not in Victoria BC my home town, anyhow.  I asked her to call and contact them...  she said she did, and said Yes, they would.  So I set that up on my BlackBerry World sign-in page using my computer, under her guidance, and it seemed to be set up.  I even purchased an app that way successfully, afterwards...  [She told me at the time that yes, there was a problem with the tool that handles VISA payments, sometimes...]
    BUT, several days later when I went to do the same thing again with another app, well, I had a message in red on my purchase screen on my Z10 that carrier purchase was not available!
    Ahem.
    So, I tried purchasing via VISA again [read my previous post, I called VISA, tried to see if there was something wrong there, no there wasn't].  No form of my re-entering my VISA card or editing it etc. would work.
    So I tried PayPal, over the past weekend I established a PayPal account to be paid for via my same VISA card, that took some doing as the procedure is not that clear on their website and you have to explore the sections under "my money" etc. to see just what is going on with it...  without any warning or info from either BlackBerry or PayPal the account wouldn't work [refused several tries to purchase an app]  until a special method for BlackBerry was posted in that "my money" section on PayPal, they call it a prepayment account or something like that, it takes about an hour or two on a Sunday for that to appear for a new account, and then [I was doing this via my computer after signing in to PayPal] I saw a side message that this purchasing procedure would not work until August 12th.
    Today, August 12th, I just purchased a trial app, Medieval Ringtones, and that went through!  Unfortunately I was on just our own house WiFi [good signal, I thought at the time, though], and just before it got installed something said "network problem" and it stopped installing.  Now I can't buy it again either, I'll try later just to see if it reloads -- it wouldn't reload to the purchase point.  I don't really care, it was an experiment.  I just downloaded a free app, Top 500 Ringtones, from BlackBerry World, and that went smoothly and seems great, lots of choices, most of them free as far as I can tell.
    Warning to users:  I would establish the PayPal account via BlackBerry World's own access point on the computer, first, through the BlackBerry World website,  clicking on their PayPal symbol, before trying to purchase via PayPal, as establishing a PayPal account first, independently,  may lead to confusion if you establish it outside of BlackBerry World.
    Now, I have noticed the work-around posted by a BlackBerry Forum guru here on using a dummy VISA account, this helpful person provides a list.  WOULD THIS HELPFUL PERSON PLEASE EXPLAIN THE PROCEDURE IN DETAIL?  i WOULD HAVE NO IDEA HOW TO DO IT IN PRACTICE -- APPARENTLY THE SOFTWARE WILL STILL CHARGE THE APP TO ONE'S REGISTERED VISA???  PLEASE GIVE DETAILED INSTRUCTIONS.
    If I can, indeed, purchase something via PayPal, or ultimately, indeed with a VISA payment, without a glitch [I'll keep trying] I'll report it here.  Meanwhile all the apps I've downloaded from BlackBerry World have been free ones, except for the one that mistakenly got sold to me via Bell billing me for it [which they won't] a few days ago [either Bell or BB got stuck with the $1.99 or something for that!].  The free ones I've downloaded have been excellent, including this Top 500 Ringtones, just the kind I was looking for, lots of real telephone and cell phone ring sounds for a purist like me...
    But I hope BlackBerry can fix up the glitch in BlackBerry World soon, it shouldn't be there at all...  my husband has the theory the facility is staffed by too small a core of software people to keep up with the problems and wasn't properly tested, or else it was subcontracted out and they are stuck with it until they get a new one -- come on, BlackBerry, get a new BlackBerry World payment procedure that works smoothly, us BlackBerry fans are anxious about you!!!

    Just to say there ARE lots of Apps on BlackBerry World, so potential BB purchasers should not let that stop them, and some very good free ones, excellent -- BlackBerry Travel is really good, and OsmAnd maps are fabulous, big to download, but when you get it you'll be amazed. Just download a provincial or smaller map to start, because they are huge files and very detailed, but lots of trails and paths are on them... good for park trails and such.

  • Using Open VI Reference to run a VI, on an RT target, with sub-VIs not loaded

    I've been using Open VI Reference and Call By Reference Node to remotely run VIs on my RT controller.  I
    usually wire string data to the vi path input, but this
    requires the VI to be in memory.  I understand (from LabVIEW help) that I can wire a path to this terminal and specify a VI that is
    not in memory, but is on the disk.  NI has an example that
    confirms my understanding.  I get errors when I attempt to do the same
    with VIs that have sub-VIs; I suspect that the problem is that
    the sub-VIs aren't in memory and that the top-level vi doesn't know where to
    look for them (because the paths aren't specified).  All of the sub-VIs are on the RT system (in the same directory), they're just not in memory.
    Is there a way to get LabVIEW to look for sub-VIs on the disk?  I don't want to rely on using a startup application and rebooting to get my VIs into memory.
    Thank you,
    Jim Carmody
    Software Engineer
    G2 Technologies
    www.g2tek.com
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice

    Hi Jim,
    It sounds like you are going about calling VIs remotely the correct way.  It would be very helpful if you could post the errors you are receiving.  I also wanted to know if you saw the note at the bottom of the article that says your VI library must contain everything your top level VI calls.
    Eric A.
    National Instruments
    Distributed I/O Product Support Engineer

  • Can read TEDS in MAX but not with DAQmx VIs

    Hi,
    I have a cdaq 9181 with a 9234 accelerometer module.  I have 3 teds equipped accelerometers connected to ai0, ai1, and ai2 repectively.  In MAX, when I reserve the chassis I can read all three teds, no errors.  When I do the same thing in labview (ie reserve the chassis, create a daqmx task, associate teds data with each physical channel, all with daqmx VIs) I can only read two out of three teds.  The third one throws a "no teds sensor detected" error.  This code has been in use for about four months now, though I just rewrote the calling VIs, and hasn't displayed this problem.  I've attached a snippet of the task building VI for reference.
    Any ideas what's going on?
    Thanks.
    Using LV2012 and MAX 5.3.1 running on Windows 7 32 bit.
    CLAD
    Attachments:
    Build Daq Task Snippet.png ‏58 KB

    Nope.  That's a delete from array, length 1, index 3.
    In any case, I eliminated that block since the string array wired to the for loop controls how many devices the VI attempts to configure.  Same result, verified it was trying to configure ai2.  Here's the updated snippet:
    CLAD
    Attachments:
    Build Daq Task Snippet v2.png ‏54 KB

  • Can anyone tell me how to fix this error I am receiving: LabView: File not found. VI "Mobile Display.vi" was stopped at unknown " " at a call to "Mobile Display.vi"?

    Can someone help me please? I am receiving this error everytime I attempt to execute my application:
    LabView: File not found. The file might have been moved or deleted, or the file path might be incorrectly formated for the operating system. For example, use \ as path separators on Windows, : on Mac OS, and / on Linux. Verify that the path is correct using the command prompt or file explorer.
    VI "Mobile Display.vi" was stopped at unknown " " at a call to "Mobile Display.vi"
    Attachments:
    labview error.jpg ‏176 KB

    We cannot help without additional information:
    Are you running your code
    ...in the development system?
    ...as a standalone application?
    ...deployed to an embedded target?
    If it is a built application, do you explicitly include dynamically called VIs in the build specification?
    Who wrote the program? Do you have access to the code?
    How is this VI called? Is there sufficient error handling?
    Do you manipulate paths as strings or as proper path datatypes with the strip path/build path primitives etc.?
    Is it running on the same OS used to develop it ...
    LabVIEW Champion . Do more with less code and in less time .

  • Calling a SubVI without providing a reference to the objects inside the SubVI?

    Hi all,
    Suppose I have a SubVI that plots Y1 vs. X1 and Y2 vs. X2 on the same XYGraph. See the attachment.
    The XYGraph property node is linked to the XYGraph. It sets the line width and point style for each curve on the XYGraph.
    If I call this SubVI 4 times in another code (to make 4 diferent XYGraphs (XYGraph1, XYGraph2, XYGraph3, XYGraph4, each containing two curves for Y1 vs. X1 and Y2 vs. X2)), 
    why would I need to create 4 different references for the 4 different XYGraphs? 
    The question really is this: if the property node is explicitly linked to the XYGraph in the SubVI, why would the property node need to be updated via a reference if the SubVI is called
    multiple times to make multiple XYGraphs? Wouldn't the SubVI take the inputs, plot the curves the XYGraph, update the property nodes and then produce a final XYGraph with
    updated properties?
    Solved!
    Go to Solution.
    Attachments:
    Plot1.vi ‏16 KB

    If this is to be a subVI why do you have a graph on its front panel and manipulating its properties? You need to be manipulating the properties of the graph on the top-level VI's front panel. You see a graph is not a datatype -- it's a display object. All that is passed through terminals to calling VIs is data, and the datatype in this case is an array of clusters containing an array of x-values and an array of y-values.
    If you want to make a subVI that does this operation you have to pass it a reference to the graph you want to manipulate as one of it's input data values.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

Maybe you are looking for