Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Run Vi using TTL input from external source

Hello guys

 

I am currently making a PIV system but I need the VI to run according to an external TTL signal.

 

I need my program to fire an LED for a number of pulses during the high time of the input TTL and not to fire during the low time of the input TTL. I am using an arudino to provide the input TTL.

 

My code is attached.

 

Thanks in Advance

0 Kudos
Message 1 of 18
(4,278 Views)

Hi shab.yaq,

 

To me it looks like you are looking for retriggerable DAQmx tasks: Retriggerable Tasks in NI-DAQmxEach time your DAQ hardware receives the external TTL trigger it will fire the pulses you defined.

 

Is this what you need? Or do you want the PIV images to be taken as long as your input TTL is "high", so to say use it as an on/off switch?


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 2 of 18
(4,241 Views)

Hi ikaiser,

 

Sort of. The camera is just activated by TTL and begins to fire according to the settings set on its software. However, the VI is controlling the laser. I want the laser to turn on and off according to the TTL high/low time.

I was trying use a case structure, it activates when the signal is high but then just continues to run until the VI is stopped.

0 Kudos
Message 3 of 18
(4,234 Views)

I think what you need is the Digital Pause Trigger as described in chapter F and G here: NI-DAQmx Data Acquisition Triggering Techniques Using LabVIEW

 

I am still not sure if this is what you mean with "I want the laser to turn on and off according to the TTL high/low time". Is this what you want to achieve?

Digital Pause Trigger triggers Pulsetrain
TTL:   0000011111000000111110000011111111110000
LASER: 0000010101000000101010000010101010100000

 


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 4 of 18
(4,223 Views)

Hello, 

 

Yes this is what I require exactly. I have the mydaq nielvis which has only one counter. How can I achieve this with one counter? 

0 Kudos
Message 5 of 18
(4,217 Views)

I didn't know the myDAQ (had to google it) but I think it should work. You don't need more than one counter. You use a counter to generate a PWM signal to for the laser (like in your VI) and just set it to be triggered. 

 

I included the code from the example linked in my last post into your VI. Find it attached. I have no idea though if it really works as I cannot test it, but you can give it a try.


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 6 of 18
(4,209 Views)

The pause trigger property node doesn't work. It says that its contains a bad terminal or unwired property?

0 Kudos
Message 7 of 18
(4,200 Views)

Maybe the myDAQ does not support it? As I wrote before I had no chance to test it.

 

What version of LabVIEW are you using? I saved the VI in 2017 SP1, so maybe it is just a version issue.

 

 

Btw, I just opened your VI again and noticed a possible issue with the wiring of your stop button. Will your inner loop ever stop? To me it seems that it never checks the current value of the stop button.


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 8 of 18
(4,197 Views)

The trigger node doesn't seem like a good option so I cant get it to work.

I'm not sure regarding the stop button but Ive changed my VI.

Would you say this would do as I require?

0 Kudos
Message 9 of 18
(4,193 Views)

Could do, but isn't perfect. There are two caveats I want to make you aware of:

1) You are checking for your trigger in your loop by reading a sample repeatedly. If the trigger pulse is too short or you looptime too long (might happen for some loops on Windows) you could miss the trigger. Won't happen with the hardware trigger (if you can make it work)

2) In the true case you set up the task first and then start it. Setting it up takes some time, to the task does not start immediately. You could set up the task outside of the checking loop and then only have to start it after the trigger. This will lower your delay between the trigger pulse and the start of your output.

 

(And your outer loop does not do anything, just in case you did not notice)

 


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 10 of 18
(4,125 Views)