Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital output line remains high after digital waveform output

Solved!
Go to solution

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?

0 Kudos
Message 1 of 3
(2,524 Views)

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

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 3
(2,502 Views)
Solution
Accepted by topic author b!tmaster

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.

0 Kudos
Message 3 of 3
(2,472 Views)