Any way to reduce delay in LabView? - Page 1
Forum section: electronics / beginners

author: LoveLaika
author_rank: Frequent Contributor
timestamp: January 14, 2025, 07:42:35 pm
content: Anyone ever worked with LabView before? I'm encountering a problem with it, and I'm at a loss on how to approach.As a proof of concept, I'm using the software to output a sine wave from a waveform generator. I want to only output the sine wave for (in this case) 2 cycles. As you can see in the image of my program, I initialize the generator, configure the waveform, enable the output, wait for the amount of time calculated for 2 cycles, and disable the output.The problem I'm facing is that it doesn't ideally start at V=0, the start of a cycle. Rather, the time to wait starts a little after the output has been enabled. So, rather than starting at the ideal time, the output sine wave has risen to a higher voltage than V=0 ideally when the waiting begins. Why is this occurring, and what can I do? I feel that it's a software delay of sorts, but I don't know how to make it more accurate.

author: joeqsmith
author_rank: Super Contributor
timestamp: January 14, 2025, 08:34:44 pm
content: This seems to be more of a question on how your Arb works. You should be able to program it to send two sweeps when sending a trigger event. Don't try and time this is software.

author: joeqsmith
author_rank: Super Contributor
timestamp: January 14, 2025, 08:55:01 pm
content: Looks like GWI decided to ripoff the Tektronix model number. Which arb do you have? Provide a link to the programming manual.https://www.tek.com/en/products/signal-generators/arbitrary-function-generator/afg2000https://www.gwinstek.com/en-US/products/detail/AFG-2100_AFG-2000

author: Sensorcat
author_rank: Regular Contributor
timestamp: January 15, 2025, 12:43:17 am
content: This has little to do with LabView. The operating system of any modern PC prevents any application program (like a LabView VI) to get direct access to hardware like an interface that is used to connect an instrument. The commands are transferred to the instrument when the operating system allows it. Without a real-time system, there's no way to force the system to use a precise schedule for that. The operating system arbitrarily assigns CPU time with little the application programmer can do about it (apart from tweaking priorities a bit).Similar issues on the receiver side: There is no guarantee that a received command is executed in a fixed time.So what to do then? Key is to let hardware do all time-critical stuff, not software. In your particular case, that means setting up the AWG to do the task completely, then, start it and let LabView stop it much later. However, it seems that the GW Instek AFG2000 lacks the function to do this: burst mode. This mode, available on most modern AWG, would let you set a 2 cycles burst as the output signal. If you do not have this, you can try to get creative with trigger / sync or ARB mode. But in the end, a more capable AWG is the better solution.

author: inse
author_rank: Super Contributor
timestamp: January 15, 2025, 05:27:11 am
content: Cumbersome workaround if no suitable function generator is available: define the desired signal burst with a pause at the end as arbitrary waveform.Use e.g. Excel to calculate and compile the waveform data to be sent to the AWG.

author: joeqsmith
author_rank: Super Contributor
timestamp: January 15, 2025, 04:35:54 pm
content: Sadly OP never responded but it does appear they have a GWI and not a Tektronix arb. Downloading their software and manual, it appears you can set the trigger to manual, then send a trigger command. Sadly I it appears undocumented in the manual but they do talk about using the external trigger for a one-shot. The Arb will sweep once and wait for the next trigger. It would make sense that the manual trigger would work this way but I don't have the arb to try it.Use these two commands manual trigger and send the trigger command and let us know if you get a single sweep or multiple.

author: LoveLaika
author_rank: Frequent Contributor
timestamp: January 15, 2025, 07:20:51 pm
content: Apologies for the delay in replying. It's a Gwinstek 2112. At least communication with it is straightforward, but you think they would update the VIs. Sad to see it incorrect.

author: LoveLaika
author_rank: Frequent Contributor
timestamp: January 15, 2025, 07:24:40 pm
content: Sorry for not replying sooner. Life happened. It's a Gwinstek 2112. The thing about triggering is that you need a source, and we don't have an external source that can do the triggering. No DAQ or signal generator that we can set to send a trigger pulse.

author: LoveLaika
author_rank: Frequent Contributor
timestamp: January 15, 2025, 07:28:05 pm
content: Thanks for replying. I'm beginning to think that this might be the way, but thing is, when we output it as an arbitrary waveform, there's no set start/stop time. It just runs continuously.

author: joeqsmith
author_rank: Super Contributor
timestamp: January 15, 2025, 09:43:02 pm
content: Quote from: LoveLaika on January 15, 2025, 07:28:05 pmSo trigger doesn't work when a arbitrary waveform is selected. Hard to believe but I don't own one to try it. Time for a better tool.

author: LoveLaika
author_rank: Frequent Contributor
timestamp: January 16, 2025, 04:01:45 am
content: After going through the available functions, we came to the conclusion that the function generator and the available options to operate it along with the delays and such are unsuitable for our needs. It wasn't just the delays; we wanted to output a portion of a signal, and we don't have any available functions to specify when to output a signal and for how long.Playing around in LabVIEW, we found that we can get what we want in software, just need a way to output it is all

author: LoveLaika
author_rank: Frequent Contributor
timestamp: January 16, 2025, 04:02:18 am
content: After going through the available functions, we came to the conclusion that the function generator and the available options to operate it along with the delays and such are unsuitable for our needs. It wasn't just the delays; we wanted to output a portion of a signal, and we don't have any available functions to specify when to output a signal and for how long.Playing around in LabVIEW, we found that we can get what we want in software, just need a way to output it is all

author: joeqsmith
author_rank: Super Contributor
timestamp: January 16, 2025, 07:00:45 pm
content: I would imagine you would load the arb with the partial wave you want to output? Of course you would need to write software to do this but should be trivial. Not being able to control the trigger as you suggest is the problem. Looks like the Arb isn't super cheap. I'm really surprised that when you use the programmable waveform, you can't control the trigger.

author: LoveLaika
author_rank: Frequent Contributor
timestamp: January 17, 2025, 04:18:42 pm
content: When outputting a continuous waveform directly from LabVIEW, the function generator's output (going to an oscilloscope) showed a delay between when we expect the sine wave to start (0 volts) and what is shown on the oscilloscope (not 0 volts). We could load an arbitrary waveform, but there's no guarantee that we will get the start/stop points that we want with the generator. It was easier to do it in LabVIEW. That way, we can send out exactly what we want, when we want, and for how long.

author: inse
author_rank: Super Contributor
timestamp: January 17, 2025, 04:27:43 pm
content: What is the hardware that generates the signal, then?How do you achieve the realtime behaviour and what does the signal need to be synchronized with?