VISA vs. semaphore lock

I have a RS485 converter attached to a serial port on a PC.  Different parts of my code need access to devices on the RS485 bus at different times, each run asynchronously.  This requires the serial port when using blocking.  I saw the Lock VISA statement, but then there is as well the instructions of semaphore.  My question is why would you use the lock VISA instead of the semaphore (size = 1) and vice versa?

Thank you!!

Hello NOR-hilator,

You can do similar things woth both.

VISA Lock locks however that your real resources, so that other functions VISA at the same time will not be able to access the same resource.

Semaphore VI allow you also synchronize/lock over large parts of your code. So it will allow you to expand your "lock".

You can also take a look at the following documents:

http://zone.NI.com/reference/en-XX/help/371361H-01/lvinstio/visa_lock_async/

http://zone.NI.com/reference/en-XX/help/371361H-01/Glang/semaphore_vis/

http://zone.NI.com/DevZone/CDA/tut/p/ID/7517

Short: First locks the resource itself. The other crashes, in your case, a piece of code, but not the resource itself.

I hope it makes more sense for you now.

Tags: NI Software

Similar Questions

  • With the help of semaphore with a Global Variable - correct use?

    Hi all

    I looked in the use of global variables and in my case, it seemed with the help of a semaphore is the appropriate solution.

    In my case, I use a global variable to store the State of the system. Asynchronous two with screw environment (same VI) will follow two COM ports to see if they get a ' login:' command prompt. If the COM port is associated with Alpha, Charlie, or Echo, it increments by 1, and if it is associated with the Bravo, Delta, or Foxtrot, is incremented by 2 GV. If the GV is 3, the rest of the code will run. In this case, it must be a port COM A, C or E; the other should be B, D or F.

    A VI parent is called inside a loop. He works for the first loop. He never adds up to 3 on the second loop, however. I can't understand why. Please let me know if my code is a poor use of semaphores, or if there is debugging I can try.

    I'm still relatively new to LV, so I'm sorry if my screws are difficult to read. I created this in LV2011.

    Thanks for any help!

    CelerityEDS wrote:

    The output of my time looping (wait GV = 3) goes to the structure of the case on the bottom right (clear SGS, PasswordEntry, etc.), so the GV get indeed consulted by the upper case structure right.

    ??

    Your right upper case structure does not run until your time ends in a loop.  The while loop does not stop until the total is equal to 3.  Where can increment you the world besides structures case you cannot yet?

    Have you tried in your point culminating execution of the VI in order to see how they are actually running?

    Another problem that I see.  Assuming that your first while the loop is going to end.  In the structures of your case, you lock the semaphore.  But you can never unlock the semaphore unless you have the right combination of conditions that allow you to get to the case that unlocks the semaphore.  The conditions are based on data that are read before the start of the case of structure, which means that data will not be read and changed until it all ends.  You have the timeout of your lock semaphore connected on one of the cases, but your semaphore lock can never timeout because you do not have a value on his entry time-out.  I think you have a situation where you can lock a semaphore, then arrive at a situation where you can not unlock, then wind locking up of your cold code.

    I don't really think that you need a semaphore at all.  I think you can protect reading and writing functional your overall using a global variable, i.e. the motor action.  Overall, I think you need to rethink the architecture of your code.

  • Example code to read an ER3000 continuousy pressure

    I working on a program to control an ER3000 and am tring to use a waveform chart to keep up the pressure. Also, I want to be able to use the current pressure to calculate the rate of Exchange to a new setting of pressure because the ships that we are in charge cannot take quick pressure changes. Does anyone have the sample code specifically for the reading of the pressure on tescoms ER3000.

    Tim,

    Taking a brief look at the llb linked above it seems as if the "fully ER Command.vi, this is what you want. This vi is read/write vi. But it runs only once. Therefore, there is not a surprise that you have a program that reads and writes to the ER3000. To "read the continuous pressure" you want to make your own vi that has the part 'read' of the 'fully ER Command.vi loop within a certain time. If find you examples in labview for VISA it should help you get started.

    Don't forget that if you want to always read the Session VISA will be 'locked '. Which means that you can't write while he performs a continuous reading of the session VISA. You can either programmatically explain this or (if RS232) you can install a sniffer that can interrogate another COM port WITHOUT interfering with your current session of VISA to the device permanently.

    Hope that it becomes at least to get started in the right direction.

    Best regards

    -chazzzmd

  • RS232 Communication tracking

    Please is there a way to control the traffic of communication RS232 via VI?

    OT sounds like you want to 'see' what the series is then port that another program is using the port as a sniffer port?

    If LabView won't do that as LabView and Ni-VISA must have access to the serial port.

    If another program is using the port NI-VISA and LabView will be locked out.

    If you start a porgram LabView NI-VISA first will lock port so no other program can access it.

    I think you need a program like part of the Sysinternals Suite from MS Technet PortMon .

  • How to avoid race conditions?

    Hi, ive done Labview for a dozen years. And this is the first time ive met or its made my code. I have a lot of code that runs at the same time. And for years, good practice in order to avoid it never repeated?

    Stu

    I spent an entire course on the race conditions and concurency in higher education, and to avoid race conditions, understand why they occur.

    Race conditions occur when several parallel processes or competitor access to a shared resource.  Furthurmore, this is especially annoying when 2 or more threads or processes are seen change a resource.  Then all first identify candidates for this when the architecture of your application.  If you only have one thread, you must be sure (although it gets more blurry since it has the ability to run in parallel).  Is it then all variables/resources that are needed in the 2 wires at the same time, and if so, you change the value in one or more threads.  If so, you have to deal with synchronization.

    Traditionally, you talk semaphors, locks and mutexes.  All methods of locking critical code (ie the resources that are sources of possible race condition).

    BUT WE ARE IN LABVIEW.  LabVIEW has a simple method which could be easier to use, functional overall.

    screws that are not marked for reentrancy is essentially a great way for the protection of data and your locking critacal sections.  That only one thread can access and or modify the data stored in the vi, at the same time.  Other threads will be blocked and wait on the resource.

    It was much more difficult to implement in c.

    Anyway the way you deal with racing conditions is to

    1. identify critical sections and resources which can cause race conditions (usually shared resources with multiple writers)

    2 lock the resource until cooked (avoid deadlocks by per se - but that is another debate)

    Unlike traditional bugs, bugs competitor are more random and very difficult to reproduce/test for so you will have to deal with them in the design of architecture.

  • Impossible to install WebAuth cert on 5508 WLC

    Hi all

    I have a certificate that is chained from a public certification authority that I am trying to download to a WLC for Secure Web Auth (guest wireless). On the TFTP transfer, I get a message "error installation of certificate".

    Newspapers are below. Any ideas?

    (Cisco Controller) > transfer download starts

    Mode............................................. TFTP
    Data Type........................................ Site Cert
    TFTP Server IP... 10.205.2.31
    TFTP package Timeout... 6
    Attempts to TFTP Max... 10
    TFTP Path........................................ /
    Name of the TFTP file... final.pem

    This can take some time.
    Are you sure you want to start? y (y/N)
    * TransferTask: 03:32:59.938 Mar 30: memory approve the policy increased from 0 to 1

    * TransferTask: 03:32:59.938 Mar 30: RESULT_STRING: transfer of Webauth TFTP from cert.

    Transfer of Webauth TFTP from cert.
    * TransferTask: 03:32:59.938 30 March: RESULT_CODE:1

    * TransferTask: 03:33:03.942 Mar 30: lock semaphore, pHost = 10.205.2.31 tftp pFilename = / final.pem

    * TransferTask: 03:33:04.026 Mar 30: semaphore locked, now unlock, pHost = 10.205.2.31 pFilename = / final.pem

    * TransferTask: 03:33:04.026 Mar 30: semaphore managed to unlock, pHost = 10.205.2.31 pFilename = / final.pem

    TFTP receive full... Install the certificate.
    * TransferTask: 03:33:04.026 Mar 30: TFTP: remote = 10.205.2.31 link

    * TransferTask: 03:33:04.039 30 March: end of TFP: 4186 bytes transferred (0 retransmitted packets)

    * TransferTask: 03:33:04.039 Mar 30: tftp rc = 0, pHost = 10.205.2.31 pFilename = / final.pem
    pLocalFilename = cert.p12

    * TransferTask: 03:33:04.039 Mar 30: RESULT_STRING: TFTP receive full... Install the certificate.

    * TransferTask: 03:33:04.039 30 March: RESULT_CODE:13

    * TransferTask: 03:33:08.042 Mar 30: added cert (4150 bytes) with password certificate key.

    * TransferTask: 03:33:08.057 Mar 30: sshpmCheckCert: checking return code: 0

    * TransferTask: 03:33:08.057 Mar 30: checking the result text: unable to get local issuer certificate

    Certificate of installation error.

    * TransferTask: 03:33:08.057 Mar 30: depth 0 error: unable to get local issuer certificate

    * TransferTask: 03:33:08.063 Mar 30: sshpmAddWebauthCert: certificate of decoding error, delete.

    (Cisco Controller) > * TransferTask: 03:33:08.063 Mar 30: RESULT_STRING: Setup of certificate error.

    * TransferTask: 03:33:08.064 30 March: RESULT_CODE:12

    (Cisco Controller) > * TransferTask: 03:33:08.064 Mar 30: memory approve the restored policy 1-0

    * sshpmLscTask: 03:33:17.826 Mar 30: sshpmLscTask: task of LSC received a message 4

    -Brett

    Brett!

    I had a similar problem and ended up replacing one of the intermediate CA channels by one from the website of issuers (listed under public use-able key) which fixed the issue. I don't remember too much more details than that, but maybe play with who could help... Good luck!

    Ric

  • Premiere Pro CC 2014 with NVIDIA system freezes (Win7x64)

    It appears after maybe the first Pro CC 2014 update started to freeze while editing. It seems to happen more often with 4K material and using the Ultra key and alpha blending, but can also occur with titles of 4 K. The sequences are 23.976 1080 p, with pictures of the Sony A7S mixed (50 Mbit/s-XAVC-S/H.264) and GH4 (4 K 100 Mbit/s H.264). There are also frequent accidents with GPUFoundation.dll (mercury + CUDA). Do not freeze with only rendering software. I tried a variety of drivers when you use a Quadro 5000 without change in the behaviour of gel. I tried a new GTX 770 (own installation driver) and the behaviour of gel and GPUFoundation.dll accidents are the same, but now, even the mouse freezes. With the Quadro 5000, the entire Windows GUI would freeze (now inactive), however the mouse would move again. It seems so there are problems with the NVidia drivers and first Pro CUDA on Windows code path (application errors shouldn't be able to lock the whole GUI). GPU clock shows low GPU and GPU memory during freezing. The gels will occur when switching between clips during playback or cleaning (most often to fast clean). As a developer, it feels like a kind of semaphore lock / race condition, since during the freezing of the CPU, GPU and memory usage are very low. Additional hardware information: 12 strands 2010 MacPro, 24GO RAM Win7x64 running (with the latest updates). Side note: organization used to hang in memory to the exit, but stopped after a recent forced Microsoft Update (Agency now sometimes hangs out but cannot be suspended in memory (used to have to kill him right out of each time)). This signals before? (A7S XAVC & GH4 4K images are relatively new)

    Install a GTX 970 with 4 GB of RAM and the latest drivers Nvidia (344.16) in fixed Win7x64sp1 crash "nested 4K video" and locks. Sometimes fixed by reorganization effects rendering bugs are still present (body 20141 CC).

    OSX isn't quite ready for the GTX 970/980: I made a copy of my OS X disk and put updated for version 10.10 beta 5 (Yosemite) and Nvidia drivers from here: update of Nvidia driver from the Web for Yosemite - news and updates - InsanelyMac Forum

    CUDA-Z seems to work OK, but the first reports CUDA is not available.

  • Behavior of locking/unlocking of VISA

    I'm redrawing the current VISA drivers for several instruments that we use.  Since it is possible that several different screws will want to access the same instrument more or less the same time, I want to block the instrument to ensure that certain operations occur without interruption.

    I found Async Lock VISA and VISA Unlock and decided to use them, because they are built and seem like they should do what I am trying to accomplish.  ('Use this function to obtain an exclusive lock that offers unique access to a device or resource.')  However, when I send two commands for a device and deliberately delay the release after the first, while the second command should wait until the first unlocked... I see the effects of these two commands at the same time.  Turning point performance highlight confirms that the second instance of VISA Lock Async runs successfully before the first lock has been released.  And they are configured for exclusive locks, shared locks not.

    I've attached a screenshot of an example VI that illustrates this behavior.  I do something wrong, or I somehow misinterpreted the fairly direct language in the documentation of NOR?  Do I need to use semaphores and abandon this cleaner solution?

    I think your problem is that you have access to the same resource. Look at the example program called "locking". Here, there are two different resources created.

  • Easiest way to implement a network wide lock/semaphore

    I was trying to think of a way to implement a network wide lock a semaphore. The application is that there are two computers on a network running TestStand. There is a common resource that one can use both. What is the best way to keep "up-to-date on the other.

    I thought maybe a small TCP/IP custom routine negotiating this resource or a variable shared in LabVIEW. I also thought to use the remote execution of sequence in TestStand. Someone has he done something like this before?

    Example/code sequences are always appreciated.

    You can use a lock TestStand (or any other synchronization operation) on the network by prefixing the name of lock with \\MachineName\.

    Using MachineName even for two machines and they work as well on the same lock, who will live at MachineName.

    Also, see setting up to TestStand to access synchronization distance objects in Appendix B of the reference manual.

  • VISA general parameters: Timeout Value vs Async lock timeout

    I think I found a bug in my code caused by a misunderstanding, I want to double check. In general, I set a timeout of the VISA (GPIB) using the property node ' General Settings: Timeout Value. Due to the multitude of GPIB communications that I do, I always wrap by read and write code in the async VISA locks. My previous assumed that the timeout from the setting in the property node would transfer on and be used by the node of VISA async timeout.

    In the screenshot below, "5000" is attached to the lock VISA async timeout value. If I were to delete, the time-out for the lock of async VISA would be '0' (the 'default' vi for) or '500' (as defined in the node property)?

    Thank you!

    Hi tkott,

    The value of VISA timeout property node sets the minimum for any VISA request timeout, while Timeout entry VISA Lock Async.vi specifies the maximum number of waiting to ask this lock.  The minimum expectation of property node (which by default two seconds) should take precedence when it is longer than the time-out of the VI entry, otherwise entry timeout value will define the duration of the time-out period.

    To answer your question, the node property will usually define your timeout, unless wire you a higher value of the lock of VI.  Is this the behavior you're seeing?

  • LabVIEW lock text entry in the address VISA

    When trying to either enter text in a 'permanent' for the address ENTRY for VISA-Open-Session in the block diagram or select the drop down menu on the address control VISA on the front panel, the whole of the Labview application crashes. The only way to clear is to "kill" Labview with Windows tast Manager. I tried to restart the host PC, and that did not solve the problem.

    MAX sees resources VISA?

    Otherwise you can have a Database corrupt MAX or a bad installation VISA

  • VISA READ timeout error - several GPIB resources

    Hello

    I'm working on a network 3 GPIB instruments (Optical Attenuator, amplifier in fiber, spectrum analyser), controlled using VISA sessions in Labview. When it is run separately, the three corresponding screws (which are located in three different Labview projects) works as expected. However, when they ran at the same time, one gives them timeout-1073807339 VISA READ errors. These errors seem to occur when another instrument is sending / receiving data / instructions at the same time that she is.

    The exact context of the error is either:

    -an another VI is running, which includes sending several requests and responses every 100 ms, reading

    -by failing VI starts, I get an error of waiting time among the first Subvi containing a VISA READ operation to perform (sometimes initialize.vi (in situation 1), sometimes one of the subVIs connected the rest State (State 0) on the time-out of the structure of the event).

    or:

    -the default VI is running,

    -by starting another VI, which includes repeatedly sending requests and reading the responses, the failing VI up a mistake among the first Subvi containing a VISA READ operation to run (one of the subVIs linked the State of rest (0) on the time-out of the structure of the event).

    What I tried:

    -gradually increasing the delay between the VISA WRITE and READ operations to the relevant instrument (from 10 ms to 10 s), without success. More surprising are my observations which, by operating this single VI, increasing WRITE it / READ delay results in the same timeout errors. I have found no mention of such behavior through research google and forum. I hope that this may point to a solution to the main issue,

    -switching between synchronous and asynchronous VISA WRITE / READ operations.

    -reorganization of the network GPIB to a star to a linear topology topology (three instruments have different GPIB addresses in case anyone is wondering).

    My thoughts:

    It seems to me that the error is related to a delay introduced between a VISA request and its read operation by the transmission of another query associated another instrument in the same network GPIB. But I have no idea why pass a query to another instrument would introduce such a delay, or why this delay would result in a timeout error (and only an instrument, while writing / reading in each pilot screws are basically the same). Hopefully a more experienced Labview-er will be able to shed some light on my problem.

    Included is the project that contains the default VI (main.vi) and the driver custom made use of.

    There are a number of ways. If you want to keep separate projects for instruments, you can use semaphores often slandered around calls for screws in each project. Locking is not expected or predictable, but it would give controlled access to the GPIB resource.

  • iPhone lock screen 7 on call

    I had a 6 iPhone with IOS 9, never had this problem.  When I was on a call, the screen would dim or go out so close to my ear, but never lock screen.

    Now, with 7 and 10 of the IOS iPhone, the phone goes to the lock screen during a call after the lock screen time-out is reached.  Once again, with IOS/6 s 9, the screen can decrease or out while close to the ear, but would remain in the phone app so that I can visit the call controls without having to unlock the phone, or drag the screen, etc.

    What is happening with this?

    I have the same question as well.  Not to mention if I place my call on mute on my iPhone 5 and then reaches the timeout of the screen I need to press the home button to wake the phone, press the home key to type in my password, then the phone unlocks to the home screen (not the phone app where I had left it before the lockscreen timeout) then press the green at the top of the screen to return to bar my phone controls.  At that time the person I'm talking think that I hung up because they hear from me that it took me so long to restore my phone.  It is very important during conference calls with several members.  This also happens with my iPhone 6 (which seems to be a thing of iOS10).

  • Mozzilla not respounding high cpu use plugin - container.exe computer is totally locked

    I start up firefox, and go new. Sometimes it allows me to watch for a while. without warning mozilla not respounding computer is completely locked. I try to stop the program (mozilla) sometimes it allows me, and other times it takes several tries to stop. Mozilla said plugin - container.exe CPU high usage. Happened several times in recent weeks. I updated several times without success.

    Like most of the commonly used web plugin, Flash is the most likely the cause. I don't know why the problems increased with Flash with the combination of Firefox 41 and 19 Flash. I think that people who work.

    For now, I suggest the following to minimize potential problems with Flash in your troubleshooting:

    (1) to avoid unnecessary pain on the sites where the Flash is not really essential, try to set the Flash on Click-to-Play (Ask 'activation'). This will delay the Flash start on a page, until you approve.

    To set 'Ask to activate', open the page modules using either:

    • CTRL + SHIFT + a
    • "3-bar" menu button (or tools) > Add-ons

    In the left column, click on Plugins. Search 'Shockwave Flash' and always change 'enable' to 'ask to activate '.

    With this setting, when you visit a site that wants to use the Flash, you should see a notification icon in the address bar and usually (but not always) one of the following values: a link in a gray rectangle dark in the page or an information bar sliding between the toolbar and in the page area.

    The plugin notification in the address bar icon usually resembles a little Lego block, dark gray. (If it is red, Flash must update.)

    The delay in the activation of Flash can help distinguish between the problems caused on the initial page load, put in folds and script activation vs Flash/loading bar.

    If you see a good reason to use Flash, and the site looks trustworthy, you can go ahead and click on the notification icon in the address bar to allow Flash. You can trust the site for the time being or permanently.

    But some pages use Flash only for tracking or play ads, so if you do not see an immediate need for Flash, feel free to ignore the notification! He will just stand here in case you want to use it later.

    (2) consider rolling back at the end of the extended support of Flash 18. We make the security updates, which you can find if you scroll down half way down this page: https://www.adobe.com/products/flashplayer/distribution3.html - it's for plugin-based browsers, MSI or EXE format should work.

    Most likely, you need to remove Flash 19 before this installer works. This article has a link to the uninstaller program: https://helpx.adobe.com/flash-player/.../uninstall-flash-player-windows.html.

  • SSL on v.36.0.1 locks and identity Info missing

    When I visit a url https:// on Firefox version 36.0.1 I get an exclamation rather than a lock:

    SCREENSHOTS:
    http://www.silkblooms.co.UK/images/prototypes/SSL3.jpg
    http://www.silkblooms.co.UK/images/prototypes/SSL2.jpg
    http://www.silkblooms.co.UK/images/prototypes/SSL1.jpg

    The same websites display padlocks and identity information when I use other browsers such as Chrome or IE so the problem is with FF. I have no proxy in tools > options > advanced > network > settings (so it's not that).

    Our host has fixed this:

    They have adjusted the SSLCipherSuites to solve this problem, as can be verified at:

    https://www.ssllabs.com/ssltest/analyze.html?d=silkblooms.co.UK & hideResults = we

    Finally!

    Thank you all for helping me here.

Maybe you are looking for

  • How to create iMessage timestamps

    How can I create a timestamp in iMessage settings so I get info date and time of each text message I get. I have Android and it's automatic. It of not a big deal, but may be useful in trying to remember when you sent or received a message. Here is an

  • Toshiba 40L7335DG - no Greek subtitles movies

    Hello! I am from Greece and 2 days ago, I bought my new Toshiba 40L7335DG!the problem a have is that when I use a USB watch movie Greek subtitles aren't anywhere! I've tried and with English subs but nothing! can you help me please!

  • checksum calculation

    Hi everyone in the Forum, I have an instrument used to measure some concentartion of gas which emits a series message that looks like this 2007-03-12 11:37:14 MDT,0x00000001,NH3,0.46,0.00,ppmm,21%,5.0,11,0,0,0 or 2007-03-12 11:37:22 MDT,0x00000001,NH

  • Problem with Hotkey features

    I had this problem for quite a while. I noticed that, after a few days, one of the services of ThinkPad Hotkey features, on-screen, have been disabled for some reason any and seems impossible to restore without reinstallation. For example, when I pre

  • How to re - install Free Cell

    Re-installation of free cell How to re - install or download the free cell game came with my computer. I have a HP Media Center under Windows XP. The game of free cells that came install has been uninstalled. Need help. Thank you.