LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview NXG Pause Execution without writing data on file

Hi, I am trying to get multiple strain gauges readings using cDAQ 9178 and NI 9235 module. I have the attached project for the process. My problem is when I want to pause the program (without having any more data written in the strainPTdata.txt file), the program still continues to write data between pause and resume

Also another problem is that sometimes if I wait for longer time between pause and resume I get this error message

askhassan1_1-1603234083681.png

I am new to LabVIEW and DAQ in general, I would appreciate your help! Thanks!

 

Ahmad

 

 

0 Kudos
Message 1 of 10
(1,924 Views)

Hi,

 

Basically your case may cause by buffer overflow error.

 

You can referring to few previous forums discussion topic about your application error:

https://forums.ni.com/t5/LabVIEW/error-200279/td-p/538212?profile.language=en

 

Hope it can help your project.

0 Kudos
Message 2 of 10
(1,895 Views)

Hi,

Thanks for the reply. I would check the buffer overflow thing, that would remedy the error.

However, I think the problem with the pause is still consistent. When I pause, the file is still writing values even after pause. Do you know if there is a solution for this?

 

Thanks !

0 Kudos
Message 3 of 10
(1,880 Views)

@askhassan1 wrote:

Hi,

Thanks for the reply. I would check the buffer overflow thing, that would remedy the error.

However, I think the problem with the pause is still consistent. When I pause, the file is still writing values even after pause. Do you know if there is a solution for this?

 

Thanks !


The file is still writing because there are still data in the buffer. The DAQ is still running because the DAQ is running on the DAQ device, causing the buffer overflow error. You really should not be using that Pause Execution button. Instead if you need to have the ability to pause you should include that ability in your code (a pause button, for instance, could allow you to continue to acquire data without plotting or writing it to file). 

 

On a side note, why do you have a FOR loop set to iterate only 1 time? 

0 Kudos
Message 4 of 10
(1,848 Views)

Thanks for the rely. I see now why that’s happening, so its all a buffer overflow problem. I am just wondering what could be the best way to solve it? Is it to allocate more for the buffer or is it to change the sampling rate.

 

The for loop is just set to 1 as I am only acquiring one strain measurement (just for trial), it should be changed to the number measurements later.

 

Thanks

 

0 Kudos
Message 5 of 10
(1,842 Views)

@askhassan wrote:

Thanks for the rely. I see now why that’s happening, so its all a buffer overflow problem. I am just wondering what could be the best way to solve it? Is it to allocate more for the buffer or is it to change the sampling rate.

 

 

Thanks

 


Neither of these will solve the problem. You have to actually program your pause. The Pause Execution button does not stop the DAQmx device from running. You've got to have a paused state that either continues to read the data from the DAQmx or stops the DAQmx. Allocating more for the buffer or changing the sampling rate will only delay the error.

0 Kudos
Message 6 of 10
(1,827 Views)

Thanks John

 

I am just curious why the problem does not happen if I keep the program running without any pause? If its related to the amount of data the device can handle, shouldn't it also run out soon? or that does that only happen due to the execution pause?

 

Thanks!

0 Kudos
Message 7 of 10
(1,824 Views)

@askhassan1 wrote:

Thanks John

 

I am just curious why the problem does not happen if I keep the program running without any pause? If its related to the amount of data the device can handle, shouldn't it also run out soon? or that does that only happen due to the execution pause?

 

Thanks!


The DAQmx device is putting data into the buffer. When your program is running you have a DAQmx read which is taking data out of the buffer. Your program is running fast enough that it, on average, will take data out of the buffer as quickly as the DAQmx is putting it into the bucket. When you hit the Pause button you stop the execution of your program, but the DAQmx is still running. So in this state you are putting data into the buffer but no longer looping through to take data out of the buffer. The buffer will quickly fill up. The error will only occur when your program is running if your program was unable to process the data as quickly as it is being placed in the buffer.

0 Kudos
Message 8 of 10
(1,820 Views)

Thank you so much for the clarification. Is there a suggestion of where to place a pause button to allow the stop of the execution and reading/writing of data and resume again when required?

 

Thanks

0 Kudos
Message 9 of 10
(1,805 Views)

@askhassan1 wrote:

Thank you so much for the clarification. Is there a suggestion of where to place a pause button to allow the stop of the execution and reading/writing of data and resume again when required?

 

Thanks


 

Put all of your code that is inside the loop into a case structure (in the False case). In the True case just read the DAQmx. Wire your button to the case selector. 

0 Kudos
Message 10 of 10
(1,793 Views)