Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform generation (DO) FIFO PXI-6225

Solved!
Go to solution

Hi.

 My user is asking for an upgrade to an existing system.

 

I am getting an analogue input that I need to covert into a digital waveform. Since the analogue input varies, I need to be able to vary the frequency of the digital waveform to match. I just recently discovered that I will probably need to use a line in Port 0 on my PXI-6225. I have tried using Digital Pattern Generator.VI and writing the output to a DAQmx Write.VI. I would like some verification before I go and rewire my hardware that I am on the right track.

 

Thanx.

0 Kudos
Message 1 of 10
(3,562 Views)

Hi punkmonkey,

 

You are correct that you can use clocked digital output on port 0 of your 6225 (there are 8 lines on port 0 of this device).  There is no built-in digital I/O clock on M series DAQ devices, but there are quite a few options for external signals that you may use.  A few popular choices:

1.  External Signal (Connected to one of the PFI lines)

2.  AI or AO Sample Clock (can be routed internally)

3.  The internal output of one of the on-board counters (also routed internally).

 

The best recommendation for a starting point from the LabVIEW side of things is going to depend a bit on what exactly you need to do.  Are you acquiring the analog data and converting on-the-fly or is this pre-recorded data?  Also, when you say you need to vary the frequency of the digital waveform, do you mean that the sample clock is actually changing for the AI task?  How much is the sample clock changing?

 

I think it's safe for you to rewire your hardware--hardware-timed digital data will be output on port 0 regardless of how you implement the application.

 

 

Best Regards,

John Passiak
0 Kudos
Message 2 of 10
(3,557 Views)

Hello Mr. Passiak,

 

I am acquiring the velocity data and converting on-the-fly. I am basically acting as a software encoder to pass a velocity pulse train to a 2nd external system.  

I need the frequency of my pulse train to vary with the change of my velocity.

 

Just to throw a kink, my velocity can come from 2 different systems. One is providing pulses that I convert to a scaled velocity, the other is an analog signal that I convert to a scaled velocity. Based on the user selection either one of these velocity sources need converted and sent out.

 

So in reality I'm really converting a dynamically variable double and converting on-the-fly to pass a velocity pulse train to a 2nd external system.  

 

Hope this makes sense.

 

Bill.

Message Edited by punkmonkey on 01-07-2010 08:14 AM
Message Edited by punkmonkey on 01-07-2010 08:14 AM
0 Kudos
Message 3 of 10
(3,543 Views)
Solution
Accepted by topic author punkmonkey

Hi Bill,

 

So it sounds like you need to output a pulse train that changes frequency proportional to the voltage of your analog input (or proportional to a pulse train input).  If this is the case then the best way to do this is actually NOT with the correlated digital I/O but rather with one of the on-board counters.  These would use the PFI lines rather than port 0.

 

I would start with this example which shows how to change the frequency of a TTL counter output on the fly:

Change Counter Output Frequency on the Fly

 

 

You can read from your input tasks in the same loop as the generation (or you might instead try a Producer/Consumer architecture).  I hope this helps, let me know if you have any questions!

 

 

Best Regards,

John Passiak
Message 4 of 10
(3,528 Views)

Thanx for the code.

 

I am now getting a resource conflict error.

 

ctr0 in my 6225 is being used to get encoder readings in and ctr1 is being used to send the pulse train out.

 

I have one CI Freq Virtual Channel reading ctr0 and on CO Pulse Freq Virtual Channel to write. The DAQmx Start Task.VI errors out on whichever gets to go last. Would this be due to me using High Freq w 2 counters on my CI Freq channel?

 

If needed, what is the highest frequency that the low frequency with 1 counter can read?

 

Thanx for the help so far.

Bill.

0 Kudos
Message 5 of 10
(3,515 Views)

Hi Bill,

 

That's correct, there are only 2 counters on M Series boards, the High Freq with 2 counters method uses both of these.  From what I can tell about your application, you have two options:

1.   Use the Low Frequency 1 Counter Method, and use the 2nd Counter to generate your pulses.

Pros:   More accurate frequency generation, Easier to program, Faster Response

Cons:  Poor resolution on high frequency pulse inputs

 

2.   Use a 2 Counter Method to acquire your input, and use the Correlated Digital I/O (port 0) to generate the pulses

Pros:  Can measure higher frequencies

Cons: More complicated to program, less resolution on the Frequency Output, more delay between measurement and change of frequency

 

Unless your input frequency is high, I would recommend method 1.  The low frequency method essentially measures the period of the input signal using the 80 MHz timebase.  The error of this method is going to be ±1 tick of the 80 MHz timebase (12.5 ns).  The error will be more and more noticeable at higher frequencies.  The following chart has a good summary of the accuracy of each counter input method:

 

counter_accuracy_table.png

 

 

The Sample-Clocked method is only available on STC3-based Devices (X Series and the 9174/9178 chassis).

 

 

If you must use a 2 counter method for the input signal, then you'll have to use the correlated digital lines to generate the pulse.  In this case you could only have up to a 1 MHz "timebase" since this is the maximum update rate of digital I/O.  This method is going to be a bit more involved since you will have to generate the timebase (I would suggest using FREQ OUT) for the digital lines and build your waveform appropriately on-the-fly based off of your input signals.  You would need to disable regeneration using a DAQmx Channel Property node.

 

 

What is the frequency of your input signal and output signal (maximum and minimum)? 

 

As a bit of extra information, our X Series boards have 4 counters on them and would be programmed the same as the M Series using DAQmx.

 

 

Best Regards,

John Passiak
Message 6 of 10
(3,507 Views)

Mr. Passiak,

 

First off thanx for the help so far. It has been wonderful.

 

Last item. What do I do to pass the count a 0 frequency? When my velocity=0 I can't wait an infinite amount of time for the counter to become ready.

 

Thanx.

 

 

0 Kudos
Message 7 of 10
(3,487 Views)
Never mind, I think I got the 0 velocity thing down. Has to do with low setting right?
0 Kudos
Message 8 of 10
(3,484 Views)

A frequency of "0" is going to give problems on both the acquisition and the generation side.

 

On the acquisition side, the value of the frequency measurement is latched in on the edge of the input signal.  If there is no signal present then you should get a timeout in DAQmx Read after the specified timeout duration has passed (default is 10 seconds but it is configurable as an input to DAQmx Read.vi).

 

If using the 80 MHz timebase then the 32-bit counter will rollover after ~53 seconds (2^32 / 80M).  

 

 

If you try to generate a 0 Hz signal then you will get an error saying that 0 is not supported for this property.  Instead, you should implement logic to turn off the counter output if the control signal drops below a certain value.  One thing to keep in mind is that an update will not occur until a complete period has finished generating, so at very low frequencies the counter updates might have a rather high latency to them.

 


I still am not sure what range of frequencies you need to input/output--if you give more details I might be able to offer more specific advice.

 


Best Regards,

John Passiak
0 Kudos
Message 9 of 10
(3,465 Views)

Yep, I've dealt with the acquistion 0 error before. On the counter output side I did exactly what you suggested with turning off the output under a minimum threshold. In this case it's 10 hz which is much faster than the user can respond.

 

Thanx again for all you help.

0 Kudos
Message 10 of 10
(3,462 Views)