Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

sample clock to control digital output rate

Can I use sample clock to control the digital output rate, so that they can be generated at a rate I want?
Is the generating rate constant?
0 Kudos
Message 1 of 4
(4,309 Views)
Your post is a bit short on details...

What DAQ device are you using? What "sample clock" do you mean?

The M-series devices use what NI calls "correlated" DIO. That means the DIO subsystem doesn't have its own clock, but that you can do clocked DIO using some other source of clock signals. You can use an external clock, or one of the various on-board signals, including the output of a pulse train from a counter/timer, the sample clock from a running AI or AO scanning operation, etc.

Some S-series devices can do correlated DIO also.

Some of the dedicated DIO devices have clocks and support independent clocked DIO.

The rate is constant if your source of clock pulses has a constant rate. The counter/timers on M-series produce pulse trains at a constant rate, but you can change the rate on the fly. AI and AO clocks are at a constant rate. An external clock is whatever you provide.
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 2 of 4
(4,299 Views)
I am using M series NI-6254. I have a lot of digital I/O to use but only 2 counters. I want to produce a pulse with precise delay (0.1ms resolution) and precise width upon a trigger. So I have an idea to use the clock digital output method to produce pulse. I refer to pwmwithmseries.vi example and found that they can produce pwm signal using this method.
 
Does it mean that 1000 samples takes time=1000*1/(clock frequency*1000)?
In this VI, does it mean that I need to use one counter to produce the timing?
Can I modified this VI to create a pulse with precise width upon receiving a trigger?
 
Attached is the pwmwithmseries.vi.
 
Thanks.
0 Kudos
Message 3 of 4
(4,285 Views)
Hey ecu,

John is absolutely right.  Our cards use a correlated DIO for precise hardware timing, so you'll need to provide a clock generated in hardware, such as that of the output from a counter.  You'll only need to use one clock in your application to control a TTL with 0.1 ms resolution. 

When you setup your task in LabView, you'll essentially have two separate segments of code you'll need to write.  The first will setup the task for the digital output signal and the second will construct the counter output.  You can group as many digital output channels into the same task and have them controlled by the same clock.  It is very important that you wire the error wires such that the digital output is created first - this way the TTL triggers on the counter's first tick.  The example pulse-width modulation code you included actually reverses this process.  It may still work at a lower speed, but I recommend you implement my suggestion instead.  If you do this in reverse, then it might miss the initial signals from the counter, which can cause a loss of precision.

When you set the source for your sample clock, ensure that you've enabled Advanced Terminals in the I/O Name Filtering.  Set your source to the card's Ctr0InternalOutput (as in the example), which will automatically wire the output of the counter to be the input for the digital output.

The rate you set for the sample clock will provide a ceiling for the rate of the clock because you are using hardware timing.  If this is set to 1000, then it will output 1000 samples per channel per second.  It is important that the counter's frequency be set to the same value for the sake of achieving the desired pulse width.

Hope this helps.  An even easier solution you might consider is to just use the output of the counter as your desired signal.

Have a great day!
Elijah K
Elijah Kerry
NI Director, Software Community
0 Kudos
Message 4 of 4
(4,241 Views)