Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

generate pulses with pulse width depending on input counter

Hello everyone!

-       I am a LabVIEW-beginner. I am trying to synchronize my Andorsolis cam with two laser shutters which should open and close. If one shutter is open, so the other one should stay closed.

-       I have NI USB 6211, but I don’t really think it can work out.

-       At first, I want to trigger the cam by sending a TTL-pulse (DO0), then the cam starts taking videos (frames) and sending a TTL-pulse (10-100ms) per frame. During the low state of the cam-TTL-pulses the cam cannot acquire, so within this time (1.5 ms) the shutter state should be switched (open-closed) by digital outputs (TTL pulses, DO1, 2).

-       A counter0 counts number of falling edges of the cam-TTL-signal. So the cam provides some kind of time base for my hardware control.

-        If number of falling edges is e.g. 2 then the first shutter should be opened and the second and is closed. After next three falling edges the first shutter is closed, the second one is opened etc. (attached image explains it better).

-       The duration of low-high states of DO1 and DO2 should be flexible, not only duration of 2 and following 3 falling edges like in the image.

 

My suggestions:

-       DO1 and DO2 should be triggered by the same source (falling edge of the cam-TTL-singnal?)

-       Using a counter for pulse generation (DO1, DO2) I have to put some time values of low and high states. In my case it should be dictated by the duration of e.g. two and three falling edges of the cam-TTL-signal in real time. The duration of low-high states from cam-TTL pulses can vary depending on the cam settings.

 

-       How can I set DO1 high for e.g. N=2-5, 7-9, … and low DO1 for N=5-6, 10-11, …

                              DO2 low for e.g. N=2-5, 7-9, …  and high DO2 for N=5-6, 10-11, …? It looks like a shift register can be helpful, but I cannot find an appropriate DAQmx vi for puls generation.

 

Can anyone please help me how to realize it?

Thank you a lot!

 

0 Kudos
Message 1 of 3
(5,247 Views)

Hi,

 

you said that you are new to LabVIEW - which design patterns (state machines, producer/consumer...) are already familiar to you?

 

It seems like there are no preconfigured DAQmx functions that could do the whole task for you, you will have to build a VI that controls the output by yourself. In your case, this would be a VI that counts the input levels, and sets the output to the right state depending on the counter values.

 

My idea would be to separate counting and writing the output in different loops, but since you are a beginner this might require you to learn things like communication between loops etc.

 

 

Regards,

  Michael

__________________________________
Certified LabVIEW Associate Developer
0 Kudos
Message 2 of 3
(5,143 Views)

Involving software and USB transfers in determining when to toggle the output is going to introduce non-determinism on the order of miliseconds--please don't do this.

 

Instead... you'll be happy to find that behavior you want is exactly how a counter output works (clocked digital output works too but isn't supported on the 6211):

 

CO_Ticks_Example.png'

 

 

You can run two tasks like this in parallel, but for synchronization purposes they need to either 1) be armed before the camera starts issuing pulses or 2) be armed at the same time by using an Arm Start Trigger.  You could alternatively just invert a single counter output with external hardware.

 

 

Best Regards,

John Passiak
0 Kudos
Message 3 of 3
(5,135 Views)