Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

simultaneous aquisition of analog and counter/Timer signal

Hello,
I work with encoder which generates 4kHz TTL signal. From this signal I need to derive its period of every cycle without averaging and the time stamp at every rising edge. Additionally I have to collect 2 analog signals at 50kHz sampling rate each.
I Use PCI 6221 card and LabView 8.0. I have created Express VI for Analog imputs and placed it inside  While loop, then created additional Express VI for counter signal configured for period measurement and placed it in the same loop.
the analog measurement is being received and stored very well. Unfortunately I have still difficulties to save data from counter gate simultaneousely with analog signal.
Can you give me some tips how to combine those signals into one record file?
Przemyslaw Kowalak
0 Kudos
Message 1 of 15
(5,854 Views)
Hi Przemyslaw,

Unfortunately with a counter input task you will not be able to obtain any hardware timing information along with the data.  This is because the data from this kind of task cannot be returned as the waveform datatype, only as DBL or U32.  The analog inputs work fine because the data returned from the Express VI includes the t0 and dt values associated with the samples.  If you knew that your counter input signal was exactly 4kHz you could say that the first period measurement is at time 0 and all subsequent measurements occur at 1/4kHz = .25ms intervals.

Regards,
Andrew W
National Instruments
0 Kudos
Message 2 of 15
(5,846 Views)
Hi Andrew,
That makes me very unhappy as my TTL signal frequency is not constant. The target of measurement is to find the influences of the mentioned analog signals on the fine fluctuations of TTL frequency. So definitely I need to be able to compare them in the time domain.
Before I used to scan all signals with analog input, but at much lower frequency of TTL and with only one analog signal  I had to do that with total sampling rate of 400kHz. Now I estimate that for pure analog aquisition it should be at least 500kHz per channel. I have no means to do that. Can you tell me if there is any chance to do that in other way avoiding that high sampling rate? Perhaps I could obtain only the time when every rising edge occures from counter input channel  then recalculate the period. Or should I save the data into different files and compare them leter offline?
 
Regards,
Przemyslaw Kowalak

Message Edited by pkowalak on 02-21-2007 01:48 AM

0 Kudos
Message 3 of 15
(5,842 Views)

While you can't get timing information bundled as part of a waveform datatype, you definitely CAN timestamp all the encoder's rising edges.  You would configure your counter for either Frequency or Period measurement.  In these modes, the DAQmx Timing vi should be set for "Implicit (Counter)".

Once you receive your array of frequencies or periods, you can pretty easily sum them to create an array of timestamps.  The remaining difficulty is to sync the analog and counter measurements to start at the same t=0.   I'm not sure whether you can sync the two types of measurements with express vi's because I never use express vi's.

I'm out of time now, but the kinds of terms you might search on to learn more include "frequency measurement", "Arm Start Trigger", "synchronize counter".

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 4 of 15
(5,836 Views)
Hi,
I am very fresh user of LabView and some terms do not understand really can you describe briefly what does mean:
"In these modes, the DAQmx Timing vi should be set for "Implicit (Counter)".?
I use for my aplication only express VIs, can I use spme other tool too?
 
Przemyslaw Kowalak
0 Kudos
Message 5 of 15
(5,828 Views)


 can you describe briefly what does mean:  "In these modes, the DAQmx Timing vi should be set for "Implicit (Counter)".?

When programming a task without using express VI's, one of the configuration vi's that gets called is named "DAQmx Timing.vi".  It has a little menu under it where you choose the type of timing control you are specifying.  For frequency or period measurement using a counter, the correct menu choice is "Implicit (Counter)" because the signal in question acts as a sampling clock as it's being measured.

 I use for my aplication only express VIs, can I use some other tool too?

I use the DAQmx function palette to define data acq tasks programmatically.  If you choose "Find Examples..." from the Help menu, and examine the DAQmx functions that are called to implement some of the simple examples, that will help you get started.  Quite a lot of us are largely self-taught and started just that way.

The "problem" with express vi's is that while some kinds of stuff is really easy to do, other stuff is just plain impossible.  There isn't any way to bridge the gap from the easy to the impossible.  However, if you program with the DAQmx function palette, you can work your way along from fairly simple tasks to very complex ones at your own pace.

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 6 of 15
(5,817 Views)

OK, looks that I simply have to keep on learning of new way of LabView programming. But Just a one more question. In prewious message was mentioned that I can not get timing information from hardware. But if I will use DAQmx Timing vi, it will give me accurate time stamp? I affraid that there can be some kind of distortion due to software delays for example.

regards

 

0 Kudos
Message 7 of 15
(5,808 Views)

Short answer: your timestamps can be measured with sub-microsecond hardware-level precision regardless of software delays.

Expanded notes:

1. DAQmx Timing is one of several DAQmx functions used to configure, start, read, stop, and clear data acq tasks.  It is used whenever you want to collect multiple samples of any signal.  When you *do* use it, you will define a hardware signal as a sampling clock which is why you will get good precision / accuracy.

2. The timestamps you want are something you will need to derive from your frequency measurements -- the board won't return matched pairs of freq and timestamp.  However, the mathematics is pretty simple.  Each sample interval is defined as 1/freq, and each frequency's "timestamp" is the cumulative sum of all those intervals.  (Note: the very first measurement can be a special case, representing the time from when the task started until the 1st signal edge.  This value will often be meaningless.)

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 8 of 15
(5,804 Views)
Dear Pawel,

I have created a VI (AI -- CI Period - synchronized measurement.vi) that is measuring the period of a pulse train (could be used together with your quadrate encoder channel) and analog inputs in a synchronized mode. My example is using a ArmStart trigger together with a Digital Trigger to trigger the synchronized sampling. I have put in comments to make it easier to understand the ArmStart trigger functionality. I am also attaching simple Analog Output and Pulse Train Generator VI:s which you can run together with the main application (AI -- CI Period - synchronized measurement.vi).

When it comes to generating TDMS files I recommend you to look at the attached example: Cont Acq&Graph Voltage - Write Data to File (TDMS).vi.

Please look at these files and let me know if it makes sense, and please get back to me if you need to discuss the solution or ask me about anything else.

GOOD LUCK 🙂
Have a great day!

Sincerely,
Daniel Wardzynski
AE Poland

Message 9 of 15
(5,700 Views)
0 Kudos
Message 10 of 15
(5,697 Views)