LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggered Frequency Measurement? NI 6259

Solved!
Go to solution

I'm trying to work out how to set up a frequency measurement (of a pulse train) that will be triggered by another external pulse from a different channel.

 

I have an encoder that is attached to a rotating shaft, which outputs 5V square pulses on two different channels: the first channel gives one pulse per revolution of the shaft (my intended trigger pulse), the second channel gives one pulse every 1/2500th of a revolution (ie every 0.144º)

 

Upon seeing a pulse from "channel one" (the once-per-rev pulse), I want the system to start measuring the frequencies of the pulses on "channel two". So it's NOT the average frequency over the ENTIRE revolution that I'm after: what I'm aiming for is more like a waveform graph of frequency vs angle of revolution, for one turn (ie with 2500 data points).

 

It doesn't matter if the processing time means that the system "misses" a start pulse on the next revolution, as it can always wait for the next one. The most important thing is that the start of frequency measurement is triggered at the right time.

 

 

So far I've used the Express VI/DAQ Assistant to set up a frequency measurement of the 0.144º pulses: I'm wiring these pulses to PFI9/CTR0 of the 6259 board. I've used continuous acquisition of 2500 measurements. The expected frequency range is about 40 to 200KHz (2500 pulses per rev at between 1000 and 4000 rpm.

 

That works fine, and I can plot a graph of frequency vs angle of revolution, BUT.. At the moment the start of aquisition is totally arbitrary; ie it begins when I hit "run". I can't figure out the best way to trigger this acquisition from the OTHER pulse channel. 

 

There are no external triggering options in the DAQ assistant page, so I wonder if this is even possible using an express VI - will I have to resort to lower level stuff? 

 

I'm convinced this should be easy!

 

Thanks in advance

Theo

 

Message 1 of 12
(4,565 Views)

Hello Theo,

 

Thankyou for your post.

 

The NI 6259 supports both analogue and digital external triggering. In LabVIEW, if you right click on the DAQ Assistant and go to properties, there is a triggering tab you can use. Click on the tab and under Start Trigger there is drop down boxes for Trigger Type, Edge and Trigger Source. From the information you've given I would set it up like this (screen shot below), though, you can change the settings as you please e.g. the Edge can be changed to falling.

 

Let me know if this helps

 

 

Triggering - DAQ Assistant.jpg

 

 

Kind Regards

 

Rico

 :smileyvery-happy:

Rico P
Smiley Very Happy
0 Kudos
Message 2 of 12
(4,544 Views)

Rico,

 

Many thanks for the reply. Sadly, I've been there already!

 

I'm familiar with the triggering tabs you showed, however if you set up the DAQ assistant for frequency measurement, those tabs no longer appear. 

 

I'm beginning to wonder if it's just not possible to do a triggered frequency measurement with this board? (By the way I also have a 6133 board, can anyone tell me if either - or neither! - of these boards can be configured to do what I need?)

 

Thanks

 

Theo

 

0 Kudos
Message 3 of 12
(4,536 Views)

Just a quick bump to get this back up the list. Would really appreciate any help with this one........

 

Thanks

 

Theo

0 Kudos
Message 4 of 12
(4,527 Views)

Hi Theo,

 

I've been experimenting with using triggering for acquiring frequencies. It turns out that you are correct and both can't be used at the same time. However, this applies for hardware but you can always make a work around using software. I would only do this though if the time between the trigger and the start of the acquisistion isn't to crucial.

 

Below is a quick work around I put together. I used a DAQ assistant with a digital trigger and then after put the DAQ assistant that you would be acquiring the frequency with. The first DAQ doesn't matter what signal it's set to because it's just being used to look for a digital trigger, so I set it to acquire analogue voltage.

 

So the DAQ assistant on the left is the one looking for a digital trigger and the DAQ assistant on the right will aquire the data after the trigger.

Triggering - DAQ Assistant2.jpg

 

 

I hope this helps, however, if the timing between the trigger and the start of the acquisition is critical then I will look for a better solution.

 

Let me know how it goes. Hope you have a good weekend.

 

Rico

Smiley Very Happy 

Rico P
Smiley Very Happy
0 Kudos
Message 5 of 12
(4,511 Views)

 Rico,

 

Thanks very much for getting back to me. After much trial and error today, I've actually come up with a workaround very similar to yours! 

 

First of all, you say that externally triggered frequency acquisition can't be done... do you think that is just a "board issue" (ie are there some boards that WILL allow this)??

 

My solution/ bodge is similar to yours. I put a DAQ assistant down to acquire a digital pulse (my trigger pulse), and this is inside a while loop that terminates once the first pulse is found. This is then in the first frame of a flat sequence, and in the next frame of the flat sequence comes the DAQ assistant to do the frequency measurement. 

 

It's all a bit flaky but it works!

 

Just as with your solution, the time delay between the first event and the frequency measurement is a potential issue. The shaft will be rotating at different speeds, so for a fixed time delay between the trigger pulse and the start of freq. measurment, I'm going to get an increasing angle error.

 

Whilst that error may only be small, I'm still on the lookout for other solutions (but yours and mine will keep me happy for a while!) 

 

Do you have any idea what sort of delay is likely between events, both in your solution and in the flat sequence? 

 

Thanks again for the efforts and have a good weekend yourself.

 

Cheers

 

Theo

 

0 Kudos
Message 6 of 12
(4,502 Views)

Hi Theo,

 

It sounds like you should be able to use an arm start trigger. This feature isn't available in the DAQ Assistant, so you will have to use the DAQmx API instead.

 

armstart.png

 

Here's an example of using arm start triggers, albeit with a different measurement type (two edge separation instead of frequency): NI-DAQmx Counter Input Start Trigger. If you right-click on your express VI and select "Generate NI-DAQmx Code", it will get converted to LabVIEW code that uses the DAQmx API, and you should be able to add the arm start trigger code from the example.

 

Brad

 

 

Message Edited by Brad K on 08-14-2009 03:52 PM
Message Edited by Brad K on 08-14-2009 03:52 PM
---
Brad Keryan
NI R&D
0 Kudos
Message 7 of 12
(4,497 Views)

Hi Theo,

 

Are you familiar with DAQmx under Measurements I/O in the functions pallette? Using express VIs are fine but they can be optimised with this pallette of functions. I've put together a small VI that looks for a trigger and then starts collecting data. You can change the data acquisition part to suit your application. The VI is attached. On the VI is a couple of time stamps to see how much of a delay is being caused by not being able to trigger in the same part as the acquisition; it shows the delay is negligible.

 

This works the same way as the first screen shot i sent you but the delay time and the time it takes to do each iteration is better.

 

I hope this helps, let me know how it goes.

 

Rico

Smiley Very Happy 

Rico P
Smiley Very Happy
0 Kudos
Message 8 of 12
(4,418 Views)

Hi Theo,

 

Hope all is well. Just checking how your application is going. Can you give me a status update when you get a chance.

 

Kind regards

Rico P
Smiley Very Happy
0 Kudos
Message 9 of 12
(4,363 Views)
Solution
Accepted by topic author JTed

Rico, Brad,

 

Thanks very much for your input, I'm glad to say that we got it sorted in the end. 

 

The first issue was the fact that the board I was using (PXI 6133) is not capable of doing a triggered frequency measurement in this way.

 

This was a big problem because although the LabView code was correct it still wouldn't work, leading me to doubt the code and get even more confused! However using the same code on a 6259 board worked like a charm. 

 

I used the DAQmx blocks to set up a frequency measurement channel and a trigger, configuring the trigger using the property node with an arm.start as shown in your example.

 

Thanks again for your help!

 

Theo

 

 

0 Kudos
Message 10 of 12
(4,296 Views)