LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pulse generation using ttl_pulse_vi runs slowly

Hello,
This is a simple VI to detect an edge from the channel "Vent Signal" (AI1) and send out a trigger pulse on channel AO0 (or several, up to 4) which is detected by connecting AO0 to AI6.  The AI6 channel is called Trig_Pulse.  The simulate signal VI is being used to generate a signal on AO1 that is being fed into AI1, under normal conditions AI1 would detect a signal from an external device.  This VI is part of a larger program that I have extracted it from. 

We are using a BNC-2110 breakout box, and this VI will only run as intended if there are BNC cables run from AO0 to AI6 and from AO1 to AI1, for the reasons described above. 

Essentially the problem is that after running the program for about 30 seconds the generation of the test pulse starts to lag behind the signal, so that even though the edge detection is still working properly and fast, (as indicated by the Edge Detected indicator coinciding with the trailing edge of the Vent_Signal signal) there is latency before a trigger is generated. 

If anything mildly CPU intensive is done while the VI is running it will provoke this reaction.  Additionally, the trigger will not stabilize, once the trigger has started to lag, the latency between an edge detection and generation of a pulse continues to grow larger. 

An example of correct/desired operation can be seen in correct1.jpg, the small, fixed amount of latency is acceptable.  The problem is illustrated in wrong1.jpg, note how the time between triggers continues to increase and lag further behind the edge of the vent_signal.  Please ignore the noise on the other 4 channels, as I mentioned this has been extracted from a larger VI. 

This code is being converted to run in Labview 7.0 from Labview 6.1.  It worked properly in 6.1 on a slower machine. 

I have tested it on another Labview 7.0 system an observed the same problem. 

I'd appreciate any suggestions you might have for solving the problem
0 Kudos
Message 1 of 2
(2,457 Views)

Dear Dmulreany,

You are probably getting latency from trying to do so much in the while loop each iteration. When it performs unnecessary operations, it causes latency. I recommend changing some of the Express VIs to examples that come with LabVIEW in the Example Finder and taking anything you can outside the while loop. For example, instead of the DAQ Assistant, use Cont Gen Voltage Wfm-Int Clk.vi. (Go the Example finder - Help Menu>>Find Examples. Browse Hardware Input and Output>>DAQmx>>Analog Generation>>Voltage.) In the example only the write is in the while loop. This means that it is only opening and closing the task once. Please let me know if you have any questions. Have a great day!

Sincerely,
Marni

 

0 Kudos
Message 2 of 2
(2,415 Views)