11-03-2011 02:34 PM
I have generated a biphasic square pulse in Labview using a standard square wave generator and stopping the vi from running after generating one full period of the periodic square wave. The only problem I'm having is that once I stop my code, so once the square pulse has been generated, the analog output of the NI board stays at the same voltage as the latest sample of the generated square pulse. Instead I'd like the voltage to go back to zero.
This is the same phenomenon you can observe when using Measurement & Automation when you generate an analog output and then you manually stop it, if you take a look with an oscilloscope at the output voltage it stays at the level you stopped the analog signal at.
I have attached an image of a square pulse with 1V amplitude and 1250 Hz frequency showing that the voltage level doesn't go back to zero. If I try to add even one more sample to the above curve, the voltage instantaneously bumps up to 1 , leaving me with the same problem.
Solved! Go to Solution.
11-07-2011 01:48 PM
Reading your question, there is a hardware reason that the output pins remain at the last state, the AO pins latch the last value loaded, to get the value to go back to 0 you would physically have to write out a value of 0 to port. You can do this either by adding a 0 to the end of the array of values that you are writing out, or you could do a case structure with one case have your signal generator amplitude set to 1 and another case with the signal generator set to an amplitude of 0. Point is there are a few ways you could implement this but you need to physically write a 0 out to the port when using AO.
Is there a reason you are not using a counter to generate a pulse train? If you are unfamiliar with this process an example of generating a varying frequency pulse train can be found here
Hope this helps.
11-07-2011 03:02 PM
Thank you so much for your reply.
I have attached a picture of my VI, what do you think the best way to send a zero value to the output pin is?
I have tried to concatenate another task to the one shown in the picture, using error out, to write a zero value. Unfotunately this solution seemed to take too much execution time. Using the oscilloscope I saw that the time required to the output voltage to go back to zero was too long.