取消
显示结果 
搜索替代 
您的意思是: 

Power meter

已解决!
转到解答

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 项奖励
1 条消息(共 12 条)
5,563 次查看

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



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
2 条消息(共 12 条)
5,559 次查看

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
0 项奖励
3 条消息(共 12 条)
5,555 次查看

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

0 项奖励
4 条消息(共 12 条)
5,523 次查看

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.



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
5 条消息(共 12 条)
5,499 次查看

Hi,

 

Thanks for your reply

 

I already did that and still give the error.

MosFo2sh_0-1705073537713.png

 

0 项奖励
6 条消息(共 12 条)
5,448 次查看

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
7 条消息(共 12 条)
5,443 次查看

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 项奖励
8 条消息(共 12 条)
5,438 次查看
解答
接受人 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
9 条消息(共 12 条)
5,432 次查看

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

10 条消息(共 12 条)
5,411 次查看