LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 5 strain measurement with multiple channels

Solved!
Go to solution

Hello everyone,

 

I'm currently using a NI-9237 to measure strain. I'm using a modified version of the example strain measurement vi (I added a resampling block to change my sampling frequency) and everything works perfectly fine as long as I pick a single channel. However as soon as I start working with two or more channels the vi will crash after 10 min or so into measuring and displaying Error 5 and I can't really find out why this keeps happening.

 

Any help is greatly appreciated!!

0 Kudos
Message 1 of 6
(3,356 Views)

Hi strainman,

 

The code you have posted appears to be for single channel sampling. Can you please provide the code you are using when trying to work with two or more channels? It is hard to know what is causing the error without seeing the code you are running.

 

That being said, my guess (based on the error code you have cited) is that you are trying to open your log file while it is already open in LabVIEW. For example, if you are trying to implement multichannel measurement using two separate while loops that both call the Write LabVIEW Measurement File Express VI, then they are likely to both be trying to open your log file at some point during execution. This will throw an error. A better way to do that would be to open your log file at the start of your program and periodically write to it, before closing it when you stop your program.

 

Again, it is hard to offer any specific debugging advice without seeing your most recent code. The source of the error you are experiencing will vary depending on your implementation.

 

Best,

 

Duncan W.

Message 2 of 6
(3,323 Views)

Hi Duncan,

 

thank you very much for your reply. This is actually the code I am using, but when measuring with two channels, I just select two channels in the drop down menu. This seems to work as intended as long as the measurement doesn't exceed around ten minutes. For example, when I perform a measurement for five minutes no errors show and I get all my data.

0 Kudos
Message 3 of 6
(3,314 Views)

strainman,

 

Ah okay. That makes sense. I was able to simulate an input read from a 9237 on all channels using the code you uploaded. I have been running the program for 10+ minutes and counting without any issues. As this is an odd error code to receive after running LabVIEW code for some time, you may be encountering I/O confusion between LabVIEW and another application. Are you opening the file in any other application while LabVIEW is using the file? Error code 5 suggests that you have two processes attempting to access the file simultaneously. This may be due to the internals of the Express VI you are using (unlikely), or another application attempting to access the file in tandem with LabVIEW.

 

Alternatively, I was able to find an instance of LabVIEW corrupting file references that could only be resolved by restarting LabVIEW. I would recommend restarting and see if that fixes your problem. The goal here is just to try to isolate the issue.

 

As a side note, I would highly recommend using the DAQmx API to write your measurements to file. In your current implementation, you are performing all of the file open/file close overhead each time your loop executes. A better practice would be to open the file before starting your DAQ task and not to close the file until you have finished writing all of the data.

 

Duncan W.

Message 4 of 6
(3,300 Views)

Duncan,

 

again thank you very much for your detailed answer. I'm not using any other software to access the file. However, I am currently updating my LabVIEW, so maybe that will fix the issue or at least clarify the error message.

 

I'll gladly try out the DAQmx API to write my measurements to file as soon as my update is done.

0 Kudos
Message 5 of 6
(3,289 Views)
Solution
Accepted by topic author strainman

The update seems to have fixed the error. Now everything runs smoothly.

0 Kudos
Message 6 of 6
(3,272 Views)