Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure sample rate?

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

The sampling rate is configured by the "Rate" input of the DAQmx Sample Clock vi.

 

I would strongly recommend you move all of the DAQmx driver vis except the DAQmx Write vi outside of the while loop.  Starting, configuring, and stopping a DAQmx task on every loop iteration is very processor intensive.  Instead, we should configure the task once, do the writing in the while loop, and then close the task after we leave the loop.  I've added a screenshot below to demonstrate what I'm trying to explain.

 

 

 

Also, your current setup is pulling your sample clock from an external source.  Is this intentional?  If so  I'd recommend looking at the "Cont Write Dig Port-Ext Clk.vi" shipping example.  You can locate this example using the Example Finder (Help » Find Examples...) and selective Hardware Inputs and Outputs » DAQmx » Digital Generation.

 

If you don't mean to be using an external clock, simply remove that control and the device will choose the correct internal clock for you.

Message Edited by Seth B. on 01-09-2009 09:19 AM
Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 2 of 6
(3,481 Views)

Hi,

 

Thanks you for your help.

 

I have tried that but I was told " I have give a external clock" see attachment.

 

I don't care what kind of sample clock I use, internal or external. I just want to get 1MHz DO sample rate. How can
I do it? Same means I write one "1" to the PXI 6733, it's dutation is 1 us.

Additionally in my PXI 8196 system there are PXI 6224, 6704, 5421.

Thanks,

 

Have a nice day,

 

Jie

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

Jie,

 

If you don't need an external clock, I'd recommend you look at the "Correlated Dig Write with Counter.vi" example. You can locate this example using the Example Finder (Help » Find Examples...) and selective Hardware Inputs and Outputs » DAQmx » Digital Generation.  You will need to choose your digital lines, select ctr0 for your card as the counter, and set the rate in Hz that you would like to write, then define the number of points you would like to write at that rate.

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 4 of 6
(3,447 Views)

Hi Seth,

 

Thank you so much.  I did not find  "Correlated Dig Write with Counter.vi" in Outputs » DAQmx » Digital Generation. Could you email me that VI? My email is jiejiang@andrew.cmu.edu, Thanks again.

 

Jie

CMU

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

Jie,

 

So that other people can use the example also, I've attached it to this message saved for LabVIEW 7.1.  If you have problems downloading it, I can also e-mail it to you.

 

Unzip the three VIs to your hard drive.  You may need to point the main VI to the two sub VIs when you first open it.

 

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 6 of 6
(3,430 Views)