LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I improve the timing of my 2 Digital Output signals?

Solved!
Go to solution

Hi,

 

I am using a NI DAQ Pad-6015 (usb) with Labview 8.5 and XP, to generate 2 Digital Ouputs (500ms high for the first one and  600ms high for the second one). The timing doesn't need to be very accurate so I am not using the 2 hardware clocks outputs. When runing the VI, and measuring the duration of the outputs with an oscilloscope, I get 520ms and 640ms. This is not too much of a problem, but I would still like to know, if I am doing the right thing in my program, and/or if it is possible de improve it?

 

Thanks for your help,

 

Regards,

 

Marc

0 Kudos
Message 1 of 10
(3,884 Views)

hi marc,

Try this Vi, 

Regards,
Santhosh M
Message 2 of 10
(3,875 Views)

Hi Santhosh,

 

Thank you very much for taking some time for anwsering my Question.

 

In reality I want to generate only one pulse (of 500ms for the first signal, and 600 ms for the second one) every minute (my 1000 ms while loop was only used to enable me to make a quick check on the oscilloscope.

 

I need a 500ms and 600 ms signal generation (not 2 signals of 500ms). This is way I introduced 2 wait Icons. I suppose this contributes to making the timing not very accurate. But I don't really know how to improve the programming ...

 

Marc

0 Kudos
Message 3 of 10
(3,868 Views)
One thing to do is to place the Create Channel/Start Task/End Task outside the loop exactly like the example from Santhosh. If all you have is two different wait times, you can place those in a case statement and wire that to the shift register whcih just toggles back and forth between true and false. Also, remember that you are running on windows and that is not a deterministic OS. You are bound to see some jitter. Moving to a timed loop could improve that.
Message 4 of 10
(3,846 Views)

Thanks for your help Dennis,

 

Regards,

 

Marc

0 Kudos
Message 5 of 10
(3,800 Views)

Marc,

 

I am not that familiar with the 6015, it is listed as a legacy device.

 

Santhosh and Dennis have the simple answers, The DAqmx Create task VI is sluggish at best, the fewer times you use it, the better off you are.

Make sure you are on a USB 2.0 Port. USB is the critical section.

 

Option Alpha: Pre-load the write (auto-start = false). Run the start VI when the timer expires. (I think this works on uncorrelated if you use a single sample)

Option Beta: If your DO's are Correlated you can use one of your timers to create a Clock, Use the counter internaloutput as your clock source for DO (Plenty of examples).use the regernerate value in the trigger property node if you want it to cycle. You can also use your AI sample clock if you you want to syncronise it with Acquisition.

Option Delta: Use your counters to create a pulse train (this is probably the simplest one to code), 

 

 

iTm - Senior Systems Engineer
uses: LABVIEW 2012 SP1 x86 on Windows 7 x64. cFP, cRIO, PXI-RT
Message 6 of 10
(3,784 Views)
Solution
Accepted by topic author marc france

Hi,

 

Using all your advices I get accurate measures now : only 0 to 4ms time difference over the 500 and 600 ms signals using the NI DAQPad-6015.

  

PS : Timmer was right concerning the usb advice.With my previous program when using a 6229 PCI card I had only a 10 ms différence instead of 20 ms with the usb one.

 

Thansk for your help,

 

Regards,

 Marc

0 Kudos
Message 7 of 10
(3,768 Views)

I am surprised about the PCI device being so slow.

 

I havent actively used one yet (I have a PCI-e 6259 for a future project) and was expecting sub-milisecond respose from it.

 

Thanks for the heads up!

 

Looks like I will stick with my OEM USB devices (6255,6259) and do more coding on Multi-Device Triggering and Syncronisation.

The correlated DIO Lines are very powerful for acurate timing. The PFI lines are good for Sync.

I am still confused as to why they didn't allow Correlated DIO on the PFI lines as well, it has made my coding life difficult.

 

Good luck with your future coding endeavours.

 

As closing advice to DAQmx Users:

Use as Few Daqmx  Blocks as you have to, they have overheads.

 

For digital channels, it is much faster to build a channel from combined lines (Add Channel port0/line0:31) than to run a for loop adding them 1 at a time (Add Channel port0/line0..loop..Add Channel port0/line1..Loop.........)

Analogue doesn't seem to make much difference. 

 

iTm - Senior Systems Engineer
uses: LABVIEW 2012 SP1 x86 on Windows 7 x64. cFP, cRIO, PXI-RT
0 Kudos
Message 8 of 10
(3,753 Views)

Can anyone convert the vi's in this thread to labview 8?... I am trying to solve a digital on/off timing problem and i think these might help.

 

 Thanks for your help in advance.

 

Abhishek

0 Kudos
Message 9 of 10
(3,566 Views)

This VI can be convert to labview 8.0 because subvi are not compatible with old version.

 

I post a screenshot.

0 Kudos
Message 10 of 10
(3,532 Views)