Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

SynchronizationPulseSource

Hi all,

 

   i'm working on a fairly straightforward task  that's already been prototyped in labview (so we know it's possible with our boards). 

 

what i need is to continuously output two voltages while also acquiring one voltage.   it's important that everything is synchronized so that we can line up our incoming data with our ouput.   So - based on the daqmx examples,   i was trying to set the synchronizationpulsesource and  sampleclocktimebasesource on my output task,   but i get an error message! 

 

here's a stripped down version of the code i've written ---   can anyone tell me what i should be doing to make sure that my input is always aligned to my output?? 

 

 



                int outRate = 312500;
                int acqRate = 4 * outRate;


                //output Task:
                mirrorOTask.AOChannels.CreateVoltageChannel( "Dev1/ao0", "", -10, 10, NIDAQ.AOVoltageUnits.Volts);
                mirrorOTask.AOChannels.CreateVoltageChannel( "Dev1/ao1", "", -10, 10, NIDAQ.AOVoltageUnits.Volts);
                mirrorOTask.Timing.ConfigureSampleClock("",outRate, NIDAQ.SampleClockActiveEdge.Rising,NIDAQ.SampleQuantityMode.ContinuousSamples);

 


                NIDAQ.AnalogMultiChannelWriter mirrorWriter = new NIDAQ.AnalogMultiChannelWriter(mirrorOTask.Stream);
                mirrorWriter.WriteMultiSample(false, this.xyMirrorVoltage);



                //input Task stuff
                iTask.AIChannels.CreateVoltageChannel(this.pmtChanName,
                    "", NationalInstruments.DAQmx.AITerminalConfiguration.Nrse,
                    -10, 10, NIDAQ.AIVoltageUnits.Volts);
                iTask.Timing.ConfigureSampleClock("",acqRate, NIDAQ.SampleClockActiveEdge.Rising,

                                           NIDAQ.SampleQuantityMode.ContinuousSamples, 1000001);



                // Set up the start trigger

                string deviceName = this.pmtChanName.Split('/')[0];
                string terminalNameBase = "/" + GetDeviceName(deviceName) + "/";
                mirrorOTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger(
                    terminalNameBase + "ai/StartTrigger",
                    NIDAQ.DigitalEdgeStartTriggerEdge.Rising);

 


                //synchronize

                mirrorOTask.Timing.SynchronizationPulseSource = terminalNameBase + "SyncPulse";
                mirrorOTask.Timing.SampleClockTimebaseSource = terminalNameBase + "SampleClockTimebase";
               
                iTask.Control(NIDAQ.TaskAction.Verify);
                mirrorOTask.Control(NIDAQ.TaskAction.Verify);

0 Kudos
Message 1 of 4
(3,841 Views)

Hi, chicago_joe.

 

What device are you using?  What error code/message are you receiving?  Try running one of the examples and let me know if the example also generates the same error.  This will allow me to determine if the error is associated with the program or the device you're using.

 

I hope you're having a great day!

Regards,

Sara Lewandroski
Applications Engineer | National Instruments
0 Kudos
Message 2 of 4
(3,795 Views)

thanks;  good points!

 

 

the error message is "Specified property is not supported by the device or is not applicable to the task" , 

the code is -200452

and the device is an NI PCI-6259 

 

if i run the example multiDeviceSync_AIAOShardTimebaseAndTrig_DSA.2005    i get the same error code. 

 

 

one thing that occurred to me is that maybe these synchronization calls are intended to only be used across devices, 

whereas i just need to have my input happen at 4 times the output,  but they're going through the same board and therefore in principle the same clock already, right? 

 

the thing is,  there's other new error codes when i do that,   but i might just need to start a new thread for those,   if you think that the synchronization issue is settled. 

0 Kudos
Message 3 of 4
(3,791 Views)

Hi, chicago_joe.

 

I think the reason that this particular example is not working is because the PCI-6259 is not a DSA device.  This example uses channel names and functionality that is specific to National Instrument's DSA devices.  Try the Multi-Function-Synch AI-AO example in the DAQmx folder.  This example is compatible with your device and should produce the expected results.

Regards,

Sara Lewandroski
Applications Engineer | National Instruments
Message 4 of 4
(3,783 Views)