Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

measure analog signals and frequency simultaneously

Hi, I have a question. I bought a NI cDAQ-9188 chassis and seven modules. Six of them are for measurements for example the temperature, voltage... and one is a counter (NI 9401) for the frequency. With the tool 'Measurement & Automation Explorer' I created a task to measure analog signals, the temperature, voltage, current... and with the counter the frequency (engine speed). I choosed the option analog capture for the analog signals. But when I try to add a new channel for the frequency measurement, with the plus button, my NI 9401 module isn't listed anymore and no provided devices were found though my NI 9401 counter measure the frequency if i choose the option for capture with a counter. But in this option I can't add analog signales. It is possible to measure analog signals and frequency simultaneously? Yex, How? No, is there an alternative for this task? Thank you. Regards

0 Kudos
Message 1 of 8
(6,110 Views)

Hello DanielDerer,

 

you can combine the measurements in LabVIEW, it is not possible to add a digital channel to an analog task directly.

 

Sync.png

 

 

The interesting thing is to use the AI sample clock for the frequency clock so with every sample a analog input is aquired also a frequency is measured.

 

Hope it helps

best regards
Alexander
0 Kudos
Message 2 of 8
(6,097 Views)

Hello Alexander Glasner,

thank you very much for the VI. Now I understand what's the strategy. So I worked me in this VI but unfortunately there are misunderstandings. It will be nice if you can answer me.

My biggest problem is the sample clock. In my Front Panel I choose my counter cDAQ9188-1A785A3Mod7/ctr0 but what should I choose in the pull-down menu Terminal? There are several possibilities, for example cDAQ9188-1A785A3Mod7/PFI0-7, cDAQ9188-1A785A3/ai/SampleClock, onboard clock ... But I don't know which of them I should choose. And in the block diagramm is also a pull-down menu for the Sample Clock, under source, I don't know which of them I should choose. I tried several possibilities but every time an error occurs after I push the Stop button for the while-loop.

Thank You for the help

Regards

0 Kudos
Message 3 of 8
(6,036 Views)

Hello DanielDerer,

 

in the frontpanel you can chose the PFI line from the modul where you want to measure the frequency, so all PFI lines are possible.

 

In the blockdiagramm it is important to use the AiSampleClock so the AiSampleClock is the clock for the frequency measurement. Then with every sample from aI a sample from the frequency will be read.

 

If you had other questions feel free to ask.

best regards
Alexander
0 Kudos
Message 4 of 8
(6,033 Views)

Hello Alexander Glasner,

thank you for the quick answer. I followed your instructions but there is still a problem. I can run the VI normally but when i push the stop button for the while-loop there occurs an error I can't understand:

 

Capture.PNG

 

Can you explain this error or can you say what to do?

Thank You

Regards

0 Kudos
Message 5 of 8
(6,013 Views)

Hello DanielDerer,

 

here the explanation:

 

Why Do I Receive Error -201314 in Counter Sample Clock Buffered Pulse Measurements?

 

reduce the sample rate from the AI for test

best regards
Alexander
0 Kudos
Message 6 of 8
(6,007 Views)

Hello Alexander Glasner,

thanks for your efforts you made. You gave me many hints with them I created this new VI. But unfortunately it's very difficult to understand it and because of this I decided to go another way. Instead of a sample clock I choose zwo DAQ Assistant, one for the analog inputs and the other for the frequency and it works.

Anyway, thank you very much for your help and if I have another question I will ask here 🙂

Regards

0 Kudos
Message 7 of 8
(5,984 Views)

Hello,

 

I am also trying to synchronize analog and counter inputs. I also get error -201314 and understand why. The problem is that the frequency of my signal can sometimes be 0Hz so I cannot just decrease my sampling rate.

What I tried to do is handle this error when it happens (similar to http://digital.ni.com/public.nsf/allkb/D14C085E435FFC4286257AB50044926E).So, display/write to file a frequency of zero when the signal frequency drops below my sampling rate (10Hz) and dismiss the error.

This doesn't work: The next time DAQmx Read is called, it produces the error again. So, the error persists even when the signal frequency is above the sampling rate again.  I tried resetting the task by stopping and starting it again, no luck.

Is there any other way to handle this error, or to achieve what I would like to do?

 

One possibility is to use software timing and to handle the timeout error but then my analog and counter input tasks won't be synchronized. or is there a way to do that with software timing?

 

Thanks!

 

Christian

0 Kudos
Message 8 of 8
(5,833 Views)