Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

how can i run a task once?

sorry for this rather basic question :

 

i have an N-sample (multi channel) task that takes , say.. 100 milliseconds or less, 

and i want it to run exactly once. 

 

this code i wrote to output a TTL (single channel, obviously)  just keeps outputting the TTL over and over again, 

which is sort of the opposite of "exactly once" . 

 

double[] TTL = { 0, 7, 7, 0 };

double outRate = 5000;
NIDAQ.Task oTask = new NIDAQ.Task("TTL");

 

oTask.AOChannels.CreateVoltageChannel(
                this.textBox1.Text, "", -10, 10, NIDAQ.AOVoltageUnits.Volts); //TTL

oTask.Timing.ConfigureSampleClock("",
                outRate, NIDAQ.SampleClockActiveEdge.Rising,
                NIDAQ.SampleQuantityMode.ContinuousSamples);


this.TTLWriter = new NationalInstruments.DAQmx.AnalogSingleChannelWriter(oTask.Stream);
TTLWriter.WriteMultiSample(true, this.TTL);

 

 

 

 

i've also tried  using a False argument in the WriteMultiSample, 

as in:

 

 

            TTLWriter.WriteMultiSample(false, this.TTL);
            oTask.Start();
            oTask.WaitUntilDone();
            oTask.Stop();
            oTask.Dispose();

 

 

 

but that has the same effect -- sending a neverending stream of TTLs  ! 

 

how do i just run an output task exactly once? 

 

 (the device i'm using is a PCI 6733)

 

 

thanks!

 

0 Kudos
Message 1 of 1
(2,857 Views)