LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with TTL trigger

Solved!
Go to solution

Hello everybody,

 

I am trying to start image aquisition(PIV) from a TTL pulse generated in Labview. I have a TTL signal(I hope it is TTL) generated through NI hardware at zero-crossing of a periodic, 1.42Hz sinewave-type signal [I am using PXI 6221 board with SC 2345(with FT01 connected to BNC port), TTL comes from FT01].

 

After connecting to TTL trigger input,  the voltage amplitude is drops from 5V to 4.77V. The triggering seems to be working occasionally, but not on a continuous basis. I contacted company that supplied us image aquisition hardware/software and they mentioned that TTL[(0 - 5 V square wave)] should be at least 5Hz. This confused me quite a bit as I don't really know how to control TTL frequency and if my code can accomodate for that and I start to doubt my code as well. 

 

I attached my code for a reference, if somebody can give me a hand I would really appreciate it.

 

Thanks in advance!

 

Alex

0 Kudos
Message 1 of 19
(3,804 Views)

Hello Oleks,

 

It sounds like you are trying to generate a digital pulse train at 5Hz. You are trying to control the frequency of this pulse train by the zero crossing of a sine wave. Do you get a desired output periodically or is it sporadic? How long does it give you the desired output when it is working? Is there a reason why you are making your pulse trains frequency dependent on an external input? 

 

-Travis E

 

National Instruments
Product Marketer
0 Kudos
Message 2 of 19
(3,772 Views)

Hello Travis,

 

Thank you for looking into my problem. I guess I was a bit confusing in my post. According to hardware manufacture, 5Hz is the minimal frequency of a TTL signal that will turn data aquisition on. So, if the TTL signal's frequency is any number higher then 5Hz, I should not have any problems.

 

Regarding zero crossing, it is rather a condition for sending a TTL signal. Once a sine wave got to a zero crossing, my VI should send a TTL train out. I am worrying that the way I generate what is supposed to be 0-5V TTL might not be correct and that causes all problems. Unfortunatelly, my experience is not big enough to identify which part of the VI is not correct. Is there anything in this VI that you think might not be right? I can see numbers around 5V on an external voltmeter, but I can't check if the shape is correct.

 

Thanks in advance!

0 Kudos
Message 3 of 19
(3,767 Views)

Oleks,

 

You should be able to create a counter task that generates pulses at the frequency you want. Here is a community example link that shows a counter frequency output task that feeds into a counter input task: https://decibel.ni.com/content/docs/DOC-16078.

 

What still confuses me is why you are reading a sinusoid. Do you need to be able to read this in or was this just an approach you took to generate the pulse train you wanted? 

 

-Travis E

National Instruments
Product Marketer
0 Kudos
Message 4 of 19
(3,756 Views)

Hello Travis,

 

Thank you very much for the link. I am going to see if I can figure it out, from the quick glance at it, I think this is exactly what I needed.

 

Regarding the input. What I am "feeding as an input" is a signal at the moment of flow-acoustic coupling, hence the sinusoidal nature of it. In general, it could be something very different, but I need zero crossing to know where is the phase I am interested in, as such, I also sending a TTL at the very moment of zero crossing or(after known delay, in ms) at a particlar phase.

 

I will give you an update if I get everything working,

 

Oleks

0 Kudos
Message 5 of 19
(3,752 Views)

Hello Travis,

 

I am slowly going through the code that you reffered to. I was able to create a correct TTL out with it (see attached VI) that triggers my data acquisition system whenever I send it(I am using NI BNC 2110, crt 0 out). However, I still can't control the instance when that signal is sent. I thought if I enclose DAQ MX write into a case structure with a boolean input, I would be able to send a TTL pulse when the statement is TRUE(like in the case of zero crossing) and not sending anything when it is FALSE. For some reason my VI does not do that task. Am I missing something? 

 

Thanks in advance!

 

Oleks

 

0 Kudos
Message 6 of 19
(3,745 Views)
Solution
Accepted by topic author Oleks

Oleks,

 

There are a couple things that need to be changed. First, on your counter task you are entering the while loop and checking whether something was true or false. If it is false you stop the task but in the true case you never start the task again. You will have to start the task in the true state in order to have it pick up again. Also, you will want to place a DAQmx control task.vi after the timing vi and set it to commit. This will make sure that your task performs as fast as possible since after you stop the task it does not have to re-verify any data before it runs again. 

 

-Travis E

National Instruments
Product Marketer
Message 7 of 19
(3,732 Views)

Thank you Travis! That did resolve my problem. I genuinely assumed that "Start Task" was refreshed with each loop iteration, thanks for pointing on that mistake!

 

One more thing that I am debugging right now, when I connect BNC from counter out channel on my BNC board to oscilloscope and run the code, instead of 0-5V I see -2.5 - 2.5V. That seems to be causing trigger not to work in most of the cases. DId you have experience with issues like that? Can you suggest what is causing this strange behavior?

 

Thank you!

 

Oleks

0 Kudos
Message 8 of 19
(3,690 Views)

Hey Oleks,

 

How are you measureing the TTL signal comming from your device. You have to make sure you are referencing the correct ground which would be the D GND terminal from you device. The counter outputs are referenced to that ground. Can you expand on your measurement setup?

 

Regards,

 

-Travis E

National Instruments
Product Marketer
0 Kudos
Message 9 of 19
(3,654 Views)

Hello Travis,

 

To measure the signal, I connect CTR 0 OUT of BNC-2110 to an oscilloscope (Tektronix TDS 210). It shows correct frequency of the signal and kind of correct amplitude (pk-pk), kind of because it is a bit higher then 5V. However, the wave is ~ -2.5V to 2.5V and I am not really sure why.

0 Kudos
Message 10 of 19
(3,628 Views)