LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Power meter

Solved!
Go to solution

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?

0 Kudos
Message 1 of 12
(2,595 Views)

This sounds like you did not close / release the resource.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 12
(2,591 Views)

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.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 3 of 12
(2,587 Views)

I already did that and you can see the code in the attachmentimage.pngimage.png

0 Kudos
Message 4 of 12
(2,555 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 12
(2,531 Views)

Hi,

 

Thanks for your reply

 

I already did that and still give the error.

MosFo2sh_0-1705073537713.png

 

0 Kudos
Message 6 of 12
(2,480 Views)

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.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
Message 7 of 12
(2,475 Views)

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.

0 Kudos
Message 8 of 12
(2,470 Views)
Solution
Accepted by topic author MosFo2sh

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.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
Message 9 of 12
(2,464 Views)

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

Message 10 of 12
(2,443 Views)