Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

ExportSignal not working for Ai SampleClock

I am performing an analogue input task and would like to export the sample clock on a PFI pin. However, I have tried using both the

Task.ExportSignals.ExportHardwareSignal() method

and the

DaqSystem.Local.DisconnectTerminals() method

and cannot for the life of me see anything on the output pin. I was expecting a pulse at a frequency of 100Hz.

I've written a piece of test code to remove all the complexity of my larger application but with no luck. I've reduced my actions to creating an AI task with an internal clock, acquiring data continously and (attempting) to export the sample clock to PFI13. Here's my stripped down method:

 

Task myTask = new Task();
myTask.AIChannels.CreateVoltageChannel("Fast1/ai0",
                                       "",
                                       AITerminalConfiguration.Differential,
                                       -10,
                                       10,
                                       AIVoltageUnits.Volts);
myTask.Timing.ConfigureSampleClock("",
                                   100.0,
                                   SampleClockActiveEdge.Rising,
                                   SampleQuantityMode.ContinuousSamples,
                                   1000);
myTask.ExportSignals.ExportHardwareSignal(ExportSignal.SampleClock,
                                          "/Fast1/PFI13");
myTask.Control(TaskAction.Verify);
analogInReader = new AnalogSingleChannelReader(myTask.Stream);
analogInReader.SynchronizeCallbacks = true;
analogCallback = new AsyncCallback(AnalogInCallback);
asyncResult = analogInReader.BeginReadMultiSample(100,
                                                  analogCallback,
                                                  null);

 

I can see no output on PFI13 when I use this (acquisition is taking place - I plot the data on a graph). I also see no output if I change the 'ExportHardwareSignal()' method to

 

DaqSystem.Local.ConnectTerminals("/Fast1/ai/SampleClock",
                                 "/Fast1/PFI13");

Or if I use the properties of 'ExportSignals':

 

 

myTask.ExportSignals.SampleClockOutputTerminal = "/Fast1/PFI13";
myTask.ExportSignals.SampleClockOutputBehavior = SampleClockOutputBehavior.Pulse;

 

 

Other info:

 

  • I have confirmed that I can get an output on PFI13 using MAX to generate a pulse on counter 1.
  • I believe my scope is capable of seeing the 50ns pulses (it's a 1Gs/s scope).
  • My hardware is a PCIe-6259.
  • I'm using NI-DAQmx Device Driver 9.3.5
  • Visual Studio version is 2005.
  • OS is Windows XP.
  • I've tried other PFI pins with no luck.
  • I tried using the PFI13 on another device (a PCI-6224 connected to the PCIe-6259 via a RTSI cable) to export the same sample clock and saw nothing on the pin until I stopped my task at which point the output switched high.
  • I've tried finite rather continuous acquisition and see nothing.
  • I've tried outputting the AI start trigger and see nothing.

I'm now out of ideas and rapidly running out of time and would really appreciate some help.

 

Thanks.

CAS

0 Kudos
Message 1 of 2
(4,724 Views)

Well it turns out that there is nothing wrong with that code. I wasn't seeing an output due to the configuration of the custom electronics I was using to access the PFI pin. This was not coping well with the narrow sample clock pulse.

 

This has at least highlighted to me that the width of the pulse may be a problem for the hardware I am connecting it to so I have decided to modify my method to give me a wider pulse. As this information may be useful to others I thought I'd share it here. The basics (and LabVIEW method) can be found in this Knowledgebase Article.

 

To achieve a wider pulse I have replaced the line

 

myTask.ExportSignals.ExportHardwareSignal(ExportSignal.SampleClock,
                                          "/Fast1/PFI13");

 

with

 

myTask.ExportSignals.SampleClockOutputTerminal = "/Fast1/PFI13";
myTask.ExportSignals.SampleClockOutputBehavior = SampleClockOutputBehavior.Level;

 

As mentioned in the article, this causes the output on PFI13 to go high at the beginning of the sample and low when the last AI Convert begins. If data is being acquiring from a single channel, a delay can be inserted between the sample clock pulse and the AI convert signal by setting the properties:

 

Task.Timing.DelayFromSampleClockUnits
Task.Timing.DelayFromSampleClock

 Also, if data is acquired from multiple channels, a further option is to modify the inter-channel sampling rate within the sample period using the property:

 

Task.Timing.AIConvertRate

 

Hopefully this'll prove a useful summary to others.

 

CAS

 

 

 

 

0 Kudos
Message 2 of 2
(4,714 Views)