Hello,
I am using the PM100D instrument, and I wrote the code. The code worked fine the first time, but the problem comes when I try to run it again; the PM100D initialize.VI gives an error.
The error is "Specified type of lock cannot be obtained, or specified operation cannot be performed, because the resource is locked." I have to shut down the labview and open it again to run a second measurement.
The question is, how can I run the code several times without having this error?
已解决! 转到解答。
This sounds like you did not close / release the resource.
When you call initialize, you must also call close at the end. This is like, when you pick up the phone to make a call, you need to end the call, you can't just leave it hanging there.
You should perform the Initialize before the loop and Close after the loop. Many instruments do not like rapid opening and closing of resources. If I am reading the code correctly (hard to tell from the icons), then you should be able to move the measurement configuration to before the loop as well. This would just leave the reading the measurement inside the loop.
Once you have this problem you will need to shut down LabVIEW completely to release the resource. Have you tried that yet?
I use PM100Ds all the time and there are some drivers needed to get it working due to the IVI handles used as the reference.
I think I installed the main utilities on this page: Thorlabs - Your Source for Fiber Optics, Laser Diodes, Optical Instrumentation and Polarization Meas...
AND, also had to go to the older page to get the PM100D.dll installed: Thorlabs - Your Source for Fiber Optics, Laser Diodes, Optical Instrumentation and Polarization Meas...
EDIT: Don't forget to close any Thorlabs apps before you try to open the device in LabVIEW and vice-versa. I'm pretty sure they lock each other out.
Hi,
Thanks for your reply.
Yes, I tried this, and it is working when I shut down the labview and open it again.
But I thought it had a solution other than this.
I am using the PM100D from the same links you mentioned.
Anyways, thanks guys I appreciate your time and help.
You shouldn't have to close LabVIEW to keep it working unless the references are screwed up. This can happen if you neglect to close them, OR if you open too many of them at once.
I would try closing everything and rebooting your PC. After that your code with the INITIALIZE before the loop and CLOSE after the loop should work correctly.
Try running with execution highlighting on. This will slow everything down. If that makes it better put a few stall data flow in and set the delays up starting at 100 ms and going down until it screws up again.
Programming -> Timing -> stall dataflow.vim