10-04-2015 03:33 PM
I need to prepare a vi that triggers spark plugs installed on my test set-up by sending the signal after a specified time delay. I know how to make time delays in 1 ms resolution by use of wait and wait to next functions, however, I need to set a time delay lower than the magnitufde of ms (0.4 ms for instance). While I was searching, I came across this link, it uses DAQmx trigger property node (start trigger delay units). Should I use this function with ticks option or anyhing else? I am not sure how to set this time delay...
10-04-2015 05:37 PM
What is your hardware? All this would be trivial on LabVIEW RT/FPGA.
10-05-2015 01:17 AM
I am really sorry about that. I forgot to write it. It is NI USB-X 6343.
10-05-2015 08:25 AM
What is the target of the sofware being written? Is it Windows, or it is an RT target?
If it is an RT target then you should have no trouble delaying this amount of time. There are RT specific timing functions that are on the timing palette.
If it is on a Windows target then you will have more trouble. There is this thing called Windows timing or Software timing, which basically means you ask a function to do something, and if you are lucky Windows allows it to happen. If you ask to turn a boolean on, wait 1ms, then turn it off, if you are lucky it takes 1ms, if you are unlucky it takes some time more than that. Ever have your mouse lock up? Or keyboard not respond in Windows? What do you think will happen to your 1ms wait when that happens? My point is you have no amount of control over any kind of delay in Windows. An RT OS is made to run deterministically and a 1ms wait really is something like 1.0000ms (more or less).
So what can be done? Well you can use some high precision timers in Windows and loop until the amount of time you want has passed, but again the jitter will be large. I posted a VI a while ago showing how this can be done.
A better solution is to use the DAQ hardware to do the timing. If you create a finite output on your analog out, you can generate any kind of arbitrary waveform you want and it will be ran when a trigger happens. So your arbitrary waveform can be low for 0.4ms, then do whatever you want. Some examples of this can be seen in the Help >> Example Finder, showing how to do triggering, and the finite analog output.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
10-05-2015 09:09 AM
I am so sorry about the lack of information about the question. I use Labview 2014 on Win 8.1, as a hardware I have NI USB 6343. I know that software timing is a little problematic for time critical tasks so I am searching a way to utilize my daq device for timing. I do not want to do with software timing since it is problematic and not deterministic as you said. I have to use for AOs of the device for another job, so I cannot use them for this job. Can I do this job by use of counters and signal routing or something like that. I am not familiar about signal routing, but while I was searching a solution to that I bumped into that topic. As I said, I really do not know how to do that... Could you help me on that?
10-05-2015 09:22 AM
@newbieeng wrote:
II have to use for AOs of the device for another job, so I cannot use them for this job.
If you are refering to the fact that you can only run one task on the hardware at one time this is true. You need to either stop your other task to start this, or look into other options. Not knowing your whole system it is difficult to say, but it might not be possible with that hardware alone, or it might be possible, but require changing how your other code behaves.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
10-07-2015 08:07 AM
Thank you Hoovahh. I have also USB 6353 and Measurement Computing USB 4301 daq devices. I can use one of these guys. USB 4301 has 5 counters but there is no analog outputs. How can I do that by use of analog output channels? By written a square waveform as desired frequency to buffer of an analog channel, should I count its peaks and trigger on the desired time?
10-08-2015 05:23 PM
Hi Egemen!
Is there a reason why you have to use a square wave with an analog channel instead of a counter?
Casey
Applications Engineer
10-09-2015 01:21 AM
Hi Levitt2me!
Up to 5 threads above this one, Hooovahh gave a suggestion to use buffered analog output to adjust the triggering time (0.4 ms) in case of using only one device (NI USB 6343:). Because I use four AOs of my device for other task, I said that I can add other devices, which are NI USB 6353 and Measurement Computing USB 4301, that I have for timing adjustment. I just want to make a vi that triggers after 0.4 ms of a certain event.
10-12-2015 11:17 AM
newbieeng,
The link that you used in your first post should provide a good start. I would suggest using a shipping example with some changes seen at the link you posted. A good shipping example can be found in LabVIEW by navigating to Help->Find Examples... Then browsing to Hardware Input and Output->DAQmx->Analog Output->Voltage - HW-Timed Single Point Output.vi. Set the Sample Clock source to OnboardClock. Now look at the case structure of the trigger settings. Note that the same DAQmx Trigger property node is in some of the cases (same property node as in the link you posted. This is where you want to incorporate your link. Delay units should be sample clock periods and then do some math to determine start delay.