Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Can not set the sample rate of timing clock for internal clock of AO

This problem really troubles me. I am using Measurement Studio 8.20 with VS2005. My board is PC-6071E, Driver is DAQmx 8.3.
I try to set the Timing.ConfigureSampleClock to config the sample rate for AO task.
I am using internal clock, and the sample mode is FiniteSamples.
No matter what sample rate I set, the actual signal out seems alway create in about 1.25MS/s (it appoximats the default hardware sample rate). It seems that Timing.ConfigureSampleClock for sample rate does not work.
So why like this? And how I make it work?
 
Thanks,
 
Chen.
0 Kudos
Message 1 of 18
(4,183 Views)
Hey Chen,

Thanks for contacting National Instruments support.  I'm not sure why you would be running into this issue.  There is an example located in C:\Program Files\National Instruments\MeasurementStudioVS2003\DotNET\Examples\DAQmx\Analog Out\Generate Voltage\ContGenVoltageWfm_IntClk\cs  that I edited slightly to illustrate the actual sampling rate of the AO task.  I have attached it to this post for you to look at. 

The function you are referencing works on my system and is located on line 506 of the MainForm.cs file.  I write the resulting sampling rate to a textbox.  The rate in the example is determined by the Function Generator object, but it is passed to the ConfigureSampleRate function.  If you start the program it will show the computed rate.  Stop the program and change the frequency of the Sine Wave you are generating and then start the task.  You should now notice a change in the computed sampling rate. 

How are you determining that your device is outputting at a higher rate?

Let me know if you have any further questions.

Regards,

Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 2 of 18
(4,156 Views)

Thanks for your reply. Basically, I follow the example of VC# GenerateAnalogVoltage_IntClk with asyn write AO. I am using a digital oscilloscope to monitor the output AO signal from PCI-6071E. I tested timing sample rate as: 1k, 10k, 100k, 1M, 1.25MS/s. The digital oscilloscope can show the time length of the generated pulse trains. I am using Finite sample mode, the number of sample per channel is: 1k, 10k, 100k, 1M, 1.25MS for each above sampling rate. If the timing function works, then all pulse train should last about 1 second. But it seems that no matter what sampling rate was set, the resulted actual sampling rate is 1.25MS/s, which is the maximum hardware sampling rate.

Thanks,

Chen.

0 Kudos
Message 3 of 18
(4,153 Views)
Hey Chen,

Thanks for the reply.  So when you use the 1k sampling rate, for example, does the pulse train output last less then one second?  How long does it last?  One other thing you could try is to export the sample clock for the task to a PFI line and look at that directly on your scope.  This would verify that it was working or not working.  Let me know what find.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 4 of 18
(4,145 Views)

I tried to generated single square wave of period of 1 second with 50% duty cycle (the duration will be 1 second too).

Here are the the list of results:

set sampl rate, number of samples per channel, estimated duration from outout of digital oscilloscope:
1.25MS/s, 1.25MS, 1 second
1MS/s, 1MS, 0.75 second
100KS/s, 100KS, 75ms (milli second)
10KS/s, 10KS, 7.5ms
1KS/s, 1KS, 0.75ms

THe correct results for all above list should be 1
second duration for each case.

I like to try to export the sample clock for the task to a PFI line and look at that directly on. Can you post a sample C# code for this? And can you tell me how to connect the PFI line signal out? The PFI line is signal, is that ground same ground as DGN (digital ground)?

Thanks for your help,

Chen.

 

0 Kudos
Message 5 of 18
(4,137 Views)
Hey Chen,

There is a function in the help can ExportHardwareSIgnal.  It is used like this

myTask.ExportSignals.ExportHardwareSignal(NationalInstruments.DAQmx.ExportSignal.SampleClock, "PFI0");

This should export your signal to PFI 0 or another PFI line if you want.  And yes the DGND is the same GND for PFI lines.  You should be able to put a scope on the PFI line you export to and see the sample clock.  I made this change to the example I posted eariler.  Try it out on your code and then the code I post to see if the the clock changes on your machine with my code.  Then we will know if it's a card issue or a software issue.  At least we'll have a better idea.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 6 of 18
(4,132 Views)
There is error when run your code or my code with that statement of export signal. It shows:
Specified route can not be satisfied. because the hardware does not support it.
 
Can you guy do a simple test on your site. It is pretty straight forward to make sure whether the .Net package has problem. I tested on other PCI-6071E board, it is the same results. I created task in MAX to do AO write 1000 samples. When sample rate changed, the duration of the signal changed. It seems that the hardware, and the driver for MAX is correct.
I belive something is wrong with the .Net software.
 
Thanks,
 
Chen.
0 Kudos
Message 7 of 18
(4,106 Views)
Hey Chen,

I am getting a test going and I'll let you know what I find, but you could also try another PFI line.  Try that and let me know what happens.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 8 of 18
(4,085 Views)
Hey Chen,

So I have setup a test here and the sample rate does change.  I exported the sample clock out on PFI5, which is the only supported route, hence the error, sorry about that.  Anyway, I ran a test output in MAX and observed the sample clock (The sample clock is actually always on pin 44 for this device, even without the export function call), it was as expected.  I then ran the sample program we had been using and saw the sample rate I expected as I changed the rate in the program.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 9 of 18
(4,076 Views)
Hi, Kenn,
I tried too. It seems that the sample rate does change. But the output signal from AO is still wrong. In this time I alway write 1000 samples to the AO. No matter what sampling rate set in Timing.ConfigureSampleClock, the time length of the output signal from AO no changes.
 
Can you please check the AO signal directly, not just sample clock? Because what we need is AO signal.
 
I really belive something is wrong with NI's .Net package, not hardware. Because it works from MAX created task. I need to get it works as quick as possible.
 
Thanks,
 
Chen.
0 Kudos
Message 10 of 18
(4,069 Views)