LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling\Programming a pulse

For a certain experiment I have to get a pulse (configuration specified by the user) from the function generator, for say x milliseconds, then disable the output. I have the program which allows the user to configure the waveform, display it and disable the output.

The quantity  x is to be a parameter in the front panel.

Device: afg 3102
control through USB
DAQ through PCI 4472

If anyone has any suggestion then please help.
0 Kudos
Message 1 of 9
(3,716 Views)
sorry for the multiple posts.
0 Kudos
Message 2 of 9
(3,713 Views)
What exactly are you asking? What do you need specific help on?
0 Kudos
Message 3 of 9
(3,687 Views)
Ok... A VI which commands the function generator to release a pulse for a few milliseconds, then disables its output. For example, I send a pulse of frequency 2kHz Amplitude 1Vp-p  50%duty cycle for 30 milliseconds, after which it should turn the output off.


I am uploading the VI which configures and displays the waveform. But I have to specifically generate a certain pulse for a certain amount of time and then disable the output.



0 Kudos
Message 4 of 9
(3,678 Views)
One problem you have with the code is that you have 3 sections: one section creates and sends the commands to generate the pulse, another section creates and sends the commands to disable the output, and a third section performs data acquisition. There is nothing tying these 3 sections in terms of an execution order, so they can occur in any order. You should use the error cluster to enforce execution order.

That aside, you're not going to be able use software timing to accomplish generating a pulse for 30 milliseconds unless you're willing to tolerate a lot of fluctuations. At an absolute minimum you would need to put a delay between the pulse generation and the turning off operation. This would ensure that the pulse is on for at least 30 milliseconds. However, you have no way of controlling the upper limit since it's all software timed.

Is there a difference in your setup between having the output be zero Volts and it being disabled? One thing that you can try: rather than using one of the standard waveforms you can try to use the arbitrary waveform capabilities of the function generator. You can create your 30 msec pulse waveform using the LabVIEW functions and download it to the generator. You can download the drivers for that instrument from here. There's an example in there that shows you how to use the arbitrary waveform generation.
0 Kudos
Message 5 of 9
(3,671 Views)
Well, I have set the execution order. So now I have a stacked sequence, from taking the input commands, performing a delay of say 20 milliseconds, then disabling the ouput (which is equivalent to setting it to 0V) The VI is enclosed and of course the solftware fluctuations (time taken for the program itself to execute) arent visible when I try-run it in the range of seconds (2secs, 3secs etc). As you said, it would run for at least 30 milliseconds. But the experiment I am currently working on is a Penning Trap, so I have to have a fair degree of accuracy.

Is there a way to exactly compute how much time does Labview take to execute its commands, so that I have a value to subtract. S'pose the software time is 'e' milliseconds, so I have for a lower limit the minimum amount of time for which I can send the pulse. If the pulse has to be sent for 'x' milliseconds, and if 'x' is greater than 'e' then I could simply put ('x' minus 'e)' as my delay.

I did not quite understand how to implement the second solution you have proposed. Is it like, I create a pulse using 'Simulate Signal' and then download it to the generator. Though I suspect the same 'e' would appear hear too.

Note: In my VI I have removed the DAQ component to remove further unnecessary delay.
0 Kudos
Message 6 of 9
(3,647 Views)
There is no way to know what that "e" is since it will be different each time you run the program. That's why precise timing is never done using software.

What I was referring to in my other suggestion was precisely that: create the pulse you want and download the array of values to the generator. All you need to do is generate a pulse that's on for 30 msec and then it's off (0 Volts). That's pretty easy to do with the plethora of signal generation functions that come with LabVIEW. Take a look at the "Generate Arbitrary Waveform Example" that comes with the driver set that I pointed to earlier. That uses the Simulate Signal Express VI. You can use that, but you will need to generate a square wave out of it and then only take one cycle of it if it generates more than one cycle. You can always use one of the signal generation functions (such as the Pulse Pattern VI).
0 Kudos
Message 7 of 9
(3,638 Views)
There is actually a way to know the time Labview takes to execute its VIs. It is in Tools>>Profiles>>Performance and Memory. Anyhow, I agree that software should never be used for timing, as LabView itself runs in windows and time is wasted in many interrupts, all of which run into milliseconds. The time of execution of my VI was nearabout 15 milliseconds. That defeats my purpose. So I'm onto Simulate signal express now, though havent quite found the exact configuration my experiment needs.
0 Kudos
Message 8 of 9
(3,598 Views)

@Deeptanshu wrote:
There is actually a way to know the time Labview takes to execute its VIs. It is in Tools>>Profiles>>Performance and Memory.

Yes, I'm well aware of that. Smiley Wink However, that tool should not be counted on for precise timing. It's good for tracking down where you might have hangups like VIs that take longer than they should, or where you might have memory problems. Personally, I would not recommend it for precise timing benchmarks.
0 Kudos
Message 9 of 9
(3,587 Views)