Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Using PFI0 (or anything else than AI/SampleClock) as SampleClockTimebaseSource for analog out task timebase

Hello all!

 

Is there another way to use an external trigger as ao_task.timing.SampleClockTimebaseSource other than creating an analog in task with pfi as signal source and use AI/SampleClock?

 

I would like to use the SampleClockTimebaseDivisor property to divide an external timebase (preferably for different external timebases for both AI and AO).

 

I have no idea how this division stuff is handled by the daq-card/driver. Is daqmx automatically assigning a counter in the background when I use this technique, or how is the division done?

 

I'm using a PCIe-6321 DAQ-Card.

 

Thanks for your help!

 

Cheers Oli

0 Kudos
Message 1 of 5
(6,142 Views)

Hello Oli,

 

I think I do not understand what you describe in the first part. You want to use PFI0 as a SampleClockTimebaseSource, but what do you mean with "other than creating an analog in task with pfi as signal source and use AI/SampleClock"?

 

I just simulated your card and customized an example from the LV example list(Digital finite output) to involve a SampleClockTimebaseDivisor for both AI and AO.

 

I also try to assign a counter as an "extended feature", at least I can assign all 4 counter manual (Screenshot), but I think you don´t need to do it (the example-vi I send you does not have it).

 

Kind regards,

 

Janina

 

 

Download All
0 Kudos
Message 2 of 5
(6,102 Views)

Hi Janina

 

Thanks for the reply.

 

I can't open vi's because don't use/have LabView.  I have to use VB.net.

 

The only way I got timebase-divisors running (without using counters, or may explicitly using, I don't know what's going on in the driver), is like this.

 

AO - Sample Clock

ao_task.Timing.ConfigureSampleClock(
	build_line_path("PFI0"),
	ao_config_frequency,
	ao_sample_flank,
	SampleQuantityMode.ContinuousSamples,
	ao_buffer_size
)

 

 AI - Sample Clock

ai_task.Timing.ConfigureSampleClock(
    "",
    ai_config_frequency,
    ao_sample_flank,
    SampleQuantityMode.ContinuousSamples,
    10
) ' 10 will be overwritten with ai_task.Stream.Buffer.InputBufferSize = ..
ai_task.Timing.SampleClockTimebaseSource = build_line_path("ao/SampleClock")
ai_task.Timing.SampleClockTimebaseActiveEdge = SampleClockTimebaseActiveEdge.Rising 'ai_sample_flank
ai_task.Timing.SampleClockTimebaseDivisor = analog_in.timebase_divisor

 

This also works the other way around. But what i would like to do is to access PFI0 directly or import the input somehow, something like this.

ao_task.Timing.ConfigureSampleClock(
	"",
	ao_config_frequency,
	ao_sample_flank,
	SampleQuantityMode.ContinuousSamples,
	ao_buffer_size
)
ao_task.Timing.SampleClockTimebaseSource = build_line_path("PFI0")
ao_task.Timing.SampleClockTimebaseActiveEdge = SampleClockTimebaseActiveEdge.Rising
ao_task.Timing.SampleClockTimebaseDivisor = analog_out.timebase_divisor

  edit: I guess this isn't possible and I always have to use a counter to divide a timebase.

 

Best regards,
Oli


 

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

 Hello Oli,

 

I´m sorry that my example could not help you. I was looking for an replacement of the labview code for vb.net, but unfortunately could not find anything worthy.

 

If you use VB.net, do you also use Visual Studio and Measuerment Studio?

If you use it, this following example list may help you to find a better solution:

 

http://zone.ni.com/reference/en-XX/help/370473H-01/mstudiowebhelp/html/daqmxexamplesnet2008/

 

Maybe you should set the whole path in "ao_task.Timing.SampleClockTimebaseSource = build_line_path("PFI0")" like in the following example I found:

 

Configuring Task Timing in .NET
To set the source of the sample clock, the rate of the sample clock, and the number of samples to acquire or generate use the Channel.Timing.ConfigureSampleClock() function. The following code snippet creates a continuous acquisition based on an external sample clock connected to PFI 0 on the device.

analogInTask = new Task();

analogInTask.AIChannels.CreateVoltageChannel( ... );

analogInTask.Timing.ConfigureSampleClock(

"/Dev1/PFI0", // external clock source line or use "" for internal clock

10000, // expected rate of external clock or actual rate of internal clock

SampleClockActiveEdge.Rising, // acquire on rising or falling edge of ticks

SampleQuantityMode.ContinuousSamples, // continuous or finite samples

1000 // number of finite samples to acquire or used for buffer size if continuous

);

 

You could give it a try.

 

Kind regards,

 

Janina

0 Kudos
Message 4 of 5
(6,076 Views)

Hi Janina

 

Thanks a lot for your effort.

I will look at the dotNET expamples again and try to generate the clock-division with a counter.

 

Cheers,

Oli

0 Kudos
Message 5 of 5
(6,073 Views)