12-18-2014 12:33 PM
Hey all,
I'm having an issue with my DAQ. I will generate a square wave in Labview with a function generator and output that to my DAQ. The function is output by the DAQ just fine; however, when the output is stopped, a negative DC voltage remains equal to the amplitude ("drawing" below). This happens whether I use the DAQAssistant express VI, or manually create the channel, generate the function, and write/play the function on the channel. This voltage remains even after the VI is finished running. The only way to get rid of it is to physically shut the DAQ off and turn it back on. Any thoughts on why this might be, or how to fix it?
Start VI
____|____|____|____|____|____|
____|____|____|____|____|____| _ _ _ _ _ _ _ _ 0V
____|____|____|____|____|____|____________ - A V
____|____|____|____|____|____|
End VI
Tom
Solved! Go to Solution.
12-18-2014 01:44 PM
12-18-2014 02:57 PM
So the "before" shot would become something like the "after" shot? This "after" config will zero the output...right?
TG
12-18-2014 03:18 PM
12-18-2014 03:29 PM
Well, I've got a few cases. The case you saw runs once. The other case runs inside a loop, but with alternating frequency, so I duplicated the code. One frequency is generated, there is a pause, another frequency is generated, pause again, loop.
I'll give that a shot and report back.
Thanks.
TG
12-18-2014 05:05 PM
Gave it a shot. It didn't work... With the code I posted earlier (except with the scalar - "0" - like you recommended), I get the following error:
-200288
Possible reason(s):
Attempted to write a sample beyond the final sample generated. The generation has stopped, therefore the sample specified by the combination of position and offset will never be available.
Specify a position and offset which selects a sample up to, but not beyond, the final sample generated. The final sample generated can be determined by querying the total samples generated after a generation has stopped.
Attempted to Write Sample: 200000
Property: RelativeTo
Corresponding Value: Current Write Position
Property: Offset
Corresponding Value: 0
The 200000 number looks familiar. It's the number of samples I'm writing in the preceding signal generator (at 100 kHz Sample Rate). I don't know how/where to change this to 1 prior to input into the second daqmx "write". Thoughts?
TG
12-18-2014 05:17 PM
Figured it out. See the picture. It's a rat's nest of wires, but basically, just had to redefine a few properties for the second task.
I'm going to do some timing tomorrow to see if the sequential execution meets my timing needs. For now, I'm off work.
Thanks for your help.
TG
12-19-2014 01:28 PM - edited 12-19-2014 01:46 PM
OK. So I cleaned up the code a bit - see the picture. It works to zero the voltage; however...timing is an issue. At least 20-30 ms go by before the voltage is brought back to zero (see graph). I need it to return to zero right after the waveform "completes". I also tried simply adding a few data points of "0" to the end of the data - which also didn't work (see pic "Didn't Work"). Any ideas how I can reset the output quicker?
Edit: It's interesting to note - the code from "Didn't Work" actually does work. When I probe the output, the waveform looks exactly the way I want it to. The DAQ, however, won't bring the voltage to zero. Maybe more data points are needed?
TG
12-19-2014 02:13 PM - edited 12-19-2014 02:15 PM
I figured it out. I needed to add one more sample to the clock. I had added one data point to the waveform array which wasn't being written to the DAQ because the timer only wrote n samples, instead of n+1
So, to recap: I pulled the Y array out of the waveform data, inserted a "0" at the end of the waveform, reinserted the Y data into the waveform, and incremented the timer by one sample (since I added a sample to the waveform data).