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: 

Controlling Number of Samples

Hi

 

I was able to properly measure the airflow and sound parameters separately using two different LabVIEW VI’s. One of the program is responsible for measuring the respiratory airflow through a USB device connected to the computer at a sampling rate of 100Hz. The other program is responsible for acquiring lung sounds through audio jack.

 

However, when I combine both the programs in one while loop, as shown in the attachment, the combined vi. was not working properly. I tried to acquire both the signals by putting the same number of samples for both airflow and sound parameters. However, the saved data revealed that I’m not getting the same number of samples for both airflow and sound. I’m having difficulty in controlling and standardizing the number of samples for both the parameters.  

 

I added write to measurement function to record and save both the data in one file. I manage to save the data but the saved data was not in a proper arrangement and saved in multiple sheets.

 

Here I have attached the VI and the parts of the excel sheets of the data. 

 

Could anyone help me to fix this problem?

 

Thanks,

 

Priya

0 Kudos
Message 1 of 2
(1,742 Views)

There are several issues here.  One is that you are using two very different (and quite independent) input channels that (a) don't share a "clock", (b) don't share "triggers" (so starting them at the same time may be difficult), (c) appear to have different inherent sampling rates (with independent clocks).  Another is that your code is a bit of a mess and has some curious "inconsistencies".

 

First is that the analog device is unknown and apparently not driven by DAQmx, so we have little knowledge of how it works, what clock it is using, or what the various functions really do.  Second, the Sound Card has two different "Number of Samples" selected (100000 and 8000), neither a divisor or multiple of the Sampling Frequency (22500).  Third, you are using Dynamic Data Wires (always problematic) and Express VIs (which "hide" what's going on).  You might, in principle, be able to stream an Analog and a Sound independently, but combining them seems to me to be problematic.

 

Bob Schor

0 Kudos
Message 2 of 2
(1,678 Views)