Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NI USB 6343 Negative DC Voltage after Shutting off Function Generator

Solved!
Go to solution

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

0 Kudos
Message 1 of 9
(4,810 Views)
This is expected. Before stopping and closing the task, add another DAQmx Write to set the output to whatever you want. This would be done outside the loop that you have now.
0 Kudos
Message 2 of 9
(4,797 Views)

So the "before" shot would become something like the "after" shot?  This "after" config will zero the output...right?

 

TG

Download All
0 Kudos
Message 3 of 9
(4,791 Views)
Your VI only runs once? In any case, you don't need to write a waveform to the last DAQmx Write. Just a scalar will do.
0 Kudos
Message 4 of 9
(4,778 Views)

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

0 Kudos
Message 5 of 9
(4,773 Views)

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

0 Kudos
Message 6 of 9
(4,761 Views)

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

0 Kudos
Message 7 of 9
(4,759 Views)

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

Download All
0 Kudos
Message 8 of 9
(4,730 Views)
Solution
Accepted by topic author tomg09

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 Smiley Embarassed

 

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).

0 Kudos
Message 9 of 9
(4,712 Views)