From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

wirte to measurement file: stops saving immediatly

Hi all,

 

I nedd to create a VI that starts saving every time a boolean control is true. Despite the task reads in continuos mode, the VI stops saving after a while. I'm sending the VI as attachment. Moreover the sample frequency is little bit different than the one I set up. Why?

 

Thanks in advance

 

Best regards

0 Kudos
Message 1 of 4
(2,027 Views)

Try changing number of sample to be read to 5000 (instead of 1).(This will reduce the CPU usage dramatically)

Untitled.png

 

Also writing text formatted file for data with >1ksps is not feasible. so please change the file format to binary file. if you really want to have text formated data then you can write code to post process the binary file and create text file.

 

If it solves your problem then dont forget to mark the solution. also dont forget to give kudos 🙂

 

Tushar Jambhekar
tushar@jambhekar.com

Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog

Message 2 of 4
(2,024 Views)

thanks for your prompt reply, It worked. Why does it work with this change? Moreover may you be so kind to explain to me, why the sampling frequency doesn't match with the one I set up on the task definition?

 

Thanks again

 

Best regards

0 Kudos
Message 3 of 4
(2,019 Views)

Your data acquisition card has its own buffer memory in the card. when you start sampling data. the card actually contineously samples the channel and put values in this buffer.

when you call the read VI, your labview program actually reads data from that buffer and free the memory for storing subsequent samples. In order to avoid buffer overflow you must empty the buffer before it gets full.

Now for every read operation there is some overhead involved. and if you are reading only 1 sample at a time then this overhead will be huge(5000x because you are calling this VI 5000 times). instead when you change number to 5000 you reduce that overhead dramatically(only 1x).

 

Also when you are using text format. you need to convert numbers into string before writting them to file. and this conversion process is very costly in terms of processing time required. hence for high speed application we generally use binary format.

 

I would request you to mark my previous post as solution. This might help other people who are facing similar problem to quickly find the solution.

Tushar Jambhekar
tushar@jambhekar.com

Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog

0 Kudos
Message 4 of 4
(1,998 Views)