LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to synchronize freq input with analog input

Hello All,

i would like to sample analog inputs with a RPM measurement. I am using a freq-based counter input to measure RPM and use N-chan, N samples DAQmx Read.vi. The problem i am facing is;

 

1. if i use N-chan, 1-sample as DAQmxRead for my analog input channels, I can save the data to file correctly, however only up to lower sampling rates( 10Hz-20Hz) and only for a specific amount of time (say 3-4mins)

2. If i use N-Chan,N-sample as DAQmxRead.vi for my analog input channels, i cannot save the RPM data to the file. I see that the RPM values are saved only after 1 sec interval, no matter how fast you give

the sampling rate in the task.

 

Also, i am bound to use write-to-measurement-file.vi as I am using a Align-and-Resample-Waveforms.vi which saves the files correctly only if i use write-to-measurement-file.vi

 

I am using USB-6229 with 16 differential channels. I would like to achieve high sampling rates (up to 1000Hz) 

attached is the logic i am using in my code (except for Align-and-Resample-)

 

can anyone please let me know how to achieve a continous COUNTER writing to file with N-Chan,N-Samples DAQmxRead.vi?

thanks,

 

edited:: if i save the 1D Nsample data from counter input to the file, i observe continous file writing, however, i cannot save directly the 1D Nsample data from daqmx input to the file, I have to multiply the

freq by 60 to get RPM and then save this data to file... .if i perform this, and then save to file, i observe non-continous saving to file...

 

 

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 1 of 4
(2,555 Views)

Hi LV_Enthu

 

I would recommend trying to use a producer consumer topology such that you would be reading the data in the producer loop and writing it in the consumer loop. Doing so may help us pinpoint the issue. You can find the producer consumer template by going to File->New-> VI-> From Template-> Framwork -> Design Patterns -> Producer/Consumer Design Pattern (Data)

 

I also noticed that your buffer size is 200 and you're also reading 200 samples per cycle, which can cause some buffer issues. In the end you should be using N-Samples, you probably aren't seeing anything because of your buffer.

 

Also I noticed from the code you have attached that you have two parallel error wires. If you were to get some errors on the analog input branch, the while loop will not error out, so I also recommend merging your error wires into the case statements that will stop the while loop if there are errors.

Product Support Engineer
National Instruments
0 Kudos
Message 2 of 4
(2,520 Views)

Shoop Da Woop,

I wrote a code for producer consumer loop and obsered that the code works fine with a simulated device, but gets hanged when i use an actual device. both the simulated and actual device wer USB6229.

code attached...

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 3 of 4
(2,512 Views)

Hi LV_Enthu,

 

Unfortunetely I am unable to run your code because I'm missing your hardware. I would recommend simplifying the code so we can find a solution quicker, such as only focusing on either the slow file or fast file. You mentioned that you saw some results with slow frequencies, does this mean that the slow file works? And does it work competely as expected with a simulated device?

 

Jason L

Product Support Engineer
National Instruments
0 Kudos
Message 4 of 4
(2,480 Views)