LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

measure RPM and voltage at the same time

Hello,

 

I am using DAQ Assistant's (trying to avoid more difficult programming)

 

I can measure/record voltage inputs and frequency (counter) inputs, but not together in the same loop. 

 

I think the problem is the time base.  The voltage channels are sampled "continuously" at 1000hz, but the frequency input updates much slower.  I have the frequency input set to "1 sample, on demand" because that's the only way it works well by itself (not trying to sample any voltages in the same loop).


Can someone explain how often a frequency input updates?  Is it each time a TTL pulse is sensed?  How I can record voltage channels vs. time and RPM vs. time? If they must be sampled at different rates?


Thanks,

Mark

0 Kudos
Message 1 of 6
(3,357 Views)

Perhaps a simpler way to ask my question:

 

How can I record frequency at fixed time intervals, like every 0.001 seconds (1000hz sampling rate)?  If there is no updated TTL pulse within the last .001 seconds, I would like to record/display the last known value, so that there are no missing spaces.

 

This seems like a basic function, I can't believe there is no easy way to do it! 

 

0 Kudos
Message 2 of 6
(3,346 Views)

From how I understand your question: you have a voltage input that you would like to display on a graph and then you are using the frequency of that signal as RPM. Is the RPM task something that is configured in Measurement and Automation Explorer or in the DAQ Assistant?

 

I'm not sure how you're configuring your frequency input, but it sounds like it might be waiting for a certain number of samples before it returns a value. This might be why you are seeing different sampling rates for both graphs. A little more information about your hardware set-up and DAQ Assistant configuration would be helpful. If I've misunderstood any of this then please let me know.

 

Jake H | Product Manager
Message 3 of 6
(3,322 Views)

Hi Jake,

 

Thanks for replying.  I won't be back to the test location until Wednesday, but I will try to clarify as much as I can now.  I think you understand already....

 

I have a NI Daq card that can accept both counter and voltage inputs.  (PCI 6221)

 

I am sampling 4 voltage channels using Daq Assistant.  They are set up to measure "continuous samples" @ 1khz with "number of samples to read" set to 100.  They are all working great.

 

I am also trying to sample a frequency (0-5V square wave varying between 5 and 500hz) using another Daq Assistant.  When I place this Daq Assistant in the same loop as the one sampling voltages, I either get errors, or I get much slower response out of the voltage displays (can't remember exactly what the problem was, but it wasn't acceptable).  I tried using "1 sample on demand"   "1 sample hardware timed" and "continuous samples" and the errors and/or response were different, but nothing worked well.

 

When I instead make a separate while loop for the "frequency" Daq Assistant, the displays all work perfectly.  I can see the voltages at the correct rate (1khz)  and the frequency display updates whenever it reads a new pulse, and otherwise holds the last known value. 

 

The problem is, I need the two Daq Assistants to function in the same loop, because the frequency signal is the process variable for my PID controller.  I also need to be able to record both frequency and voltage using "time" as the X axis.  Basically I think everything would work if I could tell the frequency Daq Assistant to output values at 1khz, and if there was no new value within the last 0.001 seconds, it should just output the last known value.  As of now, I either seem to get errors or affect the analog voltage Daq Assistant when I try to run the two Assistants in the same loop.

 

I have a bad feeling that I might need to do actual labview programming rather than use the Assistants.  But, maybe I'll get lucky.

 

Thanks again for your advice,

 

Mark

0 Kudos
Message 4 of 6
(3,310 Views)

Hi Mark

 

I had to deal with a similar issue a few years ago.Try setting an external sample clock for the counter input acquisition. The clock source should be the clock of the analog input (see attached figure). In this way both tasks will have the same clocks and you should be able to save data in the same file. I think it should be possible to do all of that using express vi's, however using a low level programming you could take advantage of all possibilities offered by NI DAQ.

 

Regards

 

Edo

 

 

0 Kudos
Message 5 of 6
(3,284 Views)

Edo, thanks for the tip, I'll give it a try on Wednesday. 

 

Eventually I will learn Labview in detail, but for now, I just wanted to get this VI working so that I can continue with the test. 

0 Kudos
Message 6 of 6
(3,257 Views)