Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate a digital (TTL) output on a PFI?

Hi all,
I am a bit new to labview.  I am using a USB 6251 BNC.

My VI generates a sine wave (freq=23Hz) that drives a device then records the output which is synchronised with the sine wave.  What I would like to do is to generate a TTL output that is synchronised with the sine wave.  Since my DAQ card has BNC outputs, I wanted to generate the TTL output on a PFI.  I am finding it very difficult to do.  Is this possible?

Can somebody please help me out.

My VI is attached.

Thanks
Zientist
0 Kudos
Message 1 of 6
(4,037 Views)

Hi zientist,

It seems as though some of the errors you are getting are due to errors in your DAQmx sequence. You had the correct idea in that you have to share a start trigger and sample clock, however, the order in which the various tasks were started needed correction. In your example, since you are using AI Start Trigger to trigger the different tasks, you must ensure that the other tasks have already been configured and ready to receive this trigger source. Currently in your code, you have made it such that the different tasks start independently of each other and without proper data flow, LabVIEW cannot guarantee the order of execution between the tasks and this may have cause many of your problems. In order to control the execution order, you can do so by appropriately connecting the error handling wires such that your DO & AO tasks start before the AI task since in LabVIEW, a VI will not execute until all of its inputs are ready.

Another thing to note is that since both DI & DO do not have explicit start triggers, in order to synchronize a digital acquisition/generation task, you can simply use the AI Start Trigger to begin generating AI sample clock and use it to clock your digital timing. More information on this can be found in your M-Series Manual in page 6-3.

You can also use our website for more information regarding synchronization in M-Series devices.

M Series Synchronization with LabVIEW and NI-DAQmx

I have modified your code with the necessary changes so we can get you started in the right direction. I hope this helps,

S_Hong
National Instruments
Applications Engineer
0 Kudos
Message 2 of 6
(4,008 Views)
Hi S_Hong

Thanks for your advice and doing the VI.   Unfortunately I can't open the VI as I have labview 8.2 not 8.5.  Perhaps you could sent me a jpeg pic of the block diagram.

Zientist
0 Kudos
Message 3 of 6
(3,989 Views)

Hi zientist,

 

Here's the same code written in 8.2. Please let us know if you have any question.

S_Hong
National Instruments
Applications Engineer
0 Kudos
Message 4 of 6
(3,972 Views)

Hi S_Hong,

 

Thanks for your reply and sending the 8.2 version file.

 

I understand what you mean.  I have a question though.  Since you said that it is imperative to have the output signal ready to go when the input trigger is connected (I know you meant use the errors to do that), but is the following VI appropriate (attached).  Because even if I don't link the errors, as long as i trigger the analogue output signal after the signal is generated it seems to work fine.  Is there something wrong in this logic?

 

Zientist 

0 Kudos
Message 5 of 6
(3,964 Views)

Hi zientist,

 

To reiterate, since you will be triggering you analog output off of the AI start trigger, you will need to finish configuring and start your AO task so that it is ready to receive the AI trigger. So in other words, you will need to start your AO task before your AI task. As long as you can ensure this, you will not have any problems.

S_Hong
National Instruments
Applications Engineer
0 Kudos
Message 6 of 6
(3,943 Views)