Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating TTL signal on NI USB-6212

Hello,

I am working on project to design Synchronizer for my PIV system on LabView. What I have to do is: to generate two synchronized signal one to trigger laser(signal 1) and other for camera(signal 2). The signals will have some time delay between them and signal 1 will go on independently. I have made labview code for this (attached). I have used case structure(signal 2 generator inside this) within while loop to do this. Signal 1 is generated, for while loop iteration divisible by two the case structure condition becomes true and generating signal 2, wait time for loop is 500ms . This gives time delay between two signal as one second (we can control time delay by controlling divisor factor used to for while loop iteration)

The problem is I am unable to write these two signals to my NI USB6212. 

Please Help!!

Code is attached.

Thanks in advance..

0 Kudos
Message 1 of 7
(2,866 Views)

Hello, member

I check your attachment but I am not sure what you want to do. In short, do you want your device(USB-6212) to make 2 kinds of signals(which you make within the loop)?

Then, you should use 2 channels. 

Please refer to this document : https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000004B7kSAE&l=ko-KR

It describes how to write multiple waveforms to multiple channels.

0 Kudos
Message 2 of 7
(2,770 Views)

Thank you for your reply.

 

Yes I need to generate two time delayed signals. The time delay and phase difference should be controlled by us. I need to write both signals simultaneously to DAQ device and for that I need to use two separate channels. But first I need to check whether I am able to write one signal on DAQ device or not, and Highlight Execution shows control is not executing writing portion of code.

One of signals is for Laser, and other is for Camera. I want these two be synchronized.

Also, if there some other way to generate these time delayed signals please let me know.

0 Kudos
Message 3 of 7
(2,747 Views)

Ok You have a lot going on in your code. You need to look at the examples for data flow. Your first loop will not stop until you hit the stop button. You have nothing that will keep you from writing an empty waveform because the waveform may not have been generated before you write it. The analog input will start reading immediately but it will only read one time since you didn't put the read into a loop.

 

Try using a sequence to do what you are looking to try to do.

 

What is the flow if the data that you are looking to try to accomplish?

 

Your current flow is create waveform and waveform3 write waveform 3  to analog output and read the analog input once all at the same time.

 

Next time through the loop generate waveform two.

 

 

Tim
GHSP
0 Kudos
Message 4 of 7
(2,739 Views)

It should look something more like this:TTL Sequence.png

Tim
GHSP
0 Kudos
Message 5 of 7
(2,738 Views)

Thanks for your reply,

 

Actually in the earlier version my code I did same thing i.e using sequence structure I tried to generate signals. But doing so didnt yield desire output because as per sequence structure signal 1 would generate initially then after some time delay signal 2 would generate and meanwhile signal 1 is still waiting for control to return to it. Due to this when camera is triggered  (signal 2) then laser is in off state ( signal 1 is on wait) thus yielding dark images.

 

We want signal 1 to go on independently and signal 2 to be generated at some time delay or phase delay with respect to signal 1.

 

Thanks and Regards,

Abhilash

0 Kudos
Message 6 of 7
(2,716 Views)

Are you trying to output to the same analog out?

 

You are going to have to do a more complex control system if you need to do more than this. I would have you look at a state machine.

 

Please explain what you are trying to achieve a little better and I will see if I can direct you to a solution that will solve your problem.

Tim
GHSP
0 Kudos
Message 7 of 7
(2,710 Views)