Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 9263 D2A

Hi,

 

We need to transmit 2 pattern via 2 channels periodically

We use “AnalogMultiChannelWriter function and it works good, see the code below.

 

Our problem is that the number of sample in each channel is different, therefore the shorter pattern is pad with zeros.

How can we transmit periodically 2 patterns with unknow lengths independently (without zero padding)?

 

Thanks,

 

 

       fGenTask = new Task();

                for (int chIndex = 0; chIndex < channels.Length; chIndex++)

                {

                    channelName = ProduceChannelName(deviceName, channels[chIndex]);

                    fGenTask.AOChannels.CreateVoltageChannel(channelName, chNames[chIndex], min, max, AOVoltageUnits.Volts);

                }

 

                //Verify the task before doing the waveform calculations

                fGenTask.Control(TaskAction.Verify);

 

                if (fGenTask.Timing.SampleTimingType == SampleTimingType.OnDemand)

                {

                    fGenTask.Timing.SampleTimingType = SampleTimingType.SampleClock;

                }

 

                fGenTask.Timing.ConfigureSampleClock("", rate, SampleClockActiveEdge.Rising,     

SampleQuantityMode.ContinuousSamples, samplesPerBuffer);

                AnalogMultiChannelWriter writer = new AnalogMultiChannelWriter(fGenTask.Stream);

 

                writer.WriteMultiSample(false, data);

                fGenTask.Start();

0 Kudos
Message 1 of 2
(549 Views)

When writing to channels in a DAQmx task, you must write to all channels in the task and equal samples for all channels in the task.

 

The only option is to separate the channels into different tasks. Unfortunately, cDAQ supports only 1 AO task per chassis.

 

Why do you need variable sample lengths for each channel? what are you generating using AO?

 

https://www.ni.com/en/support/documentation/supplemental/18/number-of-concurrent-tasks-on-a-compactd...

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019KWYSA2&l=en-US

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 2
(518 Views)