01-26-2018 10:54 AM - edited 01-26-2018 10:58 AM
Hello,
I am using a NI USB-6229 device and working on outputting an arbitrary sequence of low's (0V) and high's (5V) on one of the digital output lines.The problem I am experiencing is after the digital waveform is output, the line the waveform was output on remains in the high state. This happens regardless of whether the last sample in the digital waveform is a 1 or a 0. My digital waveform output task is configured as shown below.
_digitalWaveformTask = new Task("DigitalOutputTask");
_digitalWaveformTask.DOChannels.CreateChannel("Dev4/port0/line0", "do0", ChannelLineGrouping.OneChannelForEachLine); _digitalWaveformTask.Timing.ConfigureSampleClock("/Dev4/ao/SampleClock", 5000, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, 1000); _digitalWaveformTask.Done += delegate { _digitalWaveformTask.Stop(); _digitalWaveformTask.Control(TaskAction.Unreserve); }; _digitalWaveformTask.Control(TaskAction.Verify);
_digitalWaveformSingleChannelWriter = new DigitalSingleChannelWriter(_digitalWaveformTask.Stream); _digitalWaveformSingleChannelWriter.WriteMultiSamplePort(false, GenerateDigitalWaveformData());
The GenerateDigitalWaveformData method generates a digital waveform of arbitrary length that alternates between high & low states. Before returning an int[] it makes sure that the last sample in the array has a value of 0, I thought that this would force the line back to a low state but it doesn't.
Edit: The digital waveform is getting output correctly from what I can tell, the line it is getting output on is simply not returning to a low state afterwards.
What am I doing wrong?
Solved! Go to Solution.
01-26-2018 04:31 PM
I'm not sure what you'll find for that specific board, but you can go into MAX and check for the possibility of configuring default power-up states. This is likely what it's reverting to when the task is cleared -- the terminals in question are no longer driven by the port but are now free to pulled back to their default state.
-Kevin P
02-02-2018 06:07 PM
The reason why my output was staying high is that I was using the wrong number of finite samples. Instead of a literal value of 1000 here I needed to make it variable and have it be equal to the number of finite samples being produced by my analog output task.