Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Create signals from software

Solved!
Go to solution

I am trying to exteranlly trigger a camera by utilizing its readout ready digital signal to invoke the next trigger.

 

The code below triggers a counter pulse, whenever there is a falling edge signal on PFI0:

camShutterOutputTask.COChannels.CreatePulseChannelTime("Dev1/ctr0", "",
                   COPulseTimeUnits.Seconds, COPulseIdleState.Low,
                   0,
                   0.000001,
                   ((double)exposure_time) / 1e6);

camShutterOutputTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("/Dev1/PFI0", DigitalEdgeStartTriggerEdge.Falling);
                camShutterOutputTask.Triggers.StartTrigger.Retriggerable = true;

Right now it works fine by connecting PFI0 to an output on USB-6002 for testing. Every time I press a button sending out a signal from USB-6002, I can see one pulse occurs.

 

However when connecting to a physical camera, PFI0 will be connected to the camera readout. I need to somehow manually initiate the first pulse from the software side to make the following loops happen. Is there a way to do that?

0 Kudos
Message 1 of 8
(4,629 Views)

Hi Joehsiao,

 

In order to better assist I have a few follow-up questions to make sure that I understand your question correctly:

 

  1. Are you using the USB-6002 to generate the counter pulse?
  2. Currently you are triggering the counter pulse task by generating a digital signal using the button attached to the USB-6002?
  3. Now, you want to trigger the counter pulse without using that button by using another method in software?

Regards,

 

Kyle S.
Applications Engineer
National Instruments
http://www.ni.com/support

0 Kudos
Message 2 of 8
(4,608 Views)

Hi Kyle,

 

I am using USB-6002's output to act as a camera's output. The analog output of USB-6002 is connected to PCI0 on PCIe-6323. USB-6002 will ouput a pulse whenever I click a button in my software. The pluse is software timed just for simplification. When I run the test, I will have two programs open, one is for sending out ouput pulses from USB-6002, the other is to get PCIe-6323 to listen to the signals from USB-6002. PCIe-6323 will create a pulse on its ctr0 whenever it sees a falling edge from USB-6002.

 

In production USB-6002 will be replace by a camera. When the camera readout is ready, the camera will ouput a 3.3 pulse, similar to the one from USB6002.

 

My question is how do I generate such signal, like the one from camera, from PCIe-6323 itself. I will only have do it once because when PCIe-6323 sends out its pulse, the pulse will open and close the camera shutter and cause the camera to send out another readout signal, which will trigger another shutter-opening-closing, creating a signal loop between the camera and PCIe-6323.

 

 

 

 

 

0 Kudos
Message 3 of 8
(4,600 Views)

Hi Joehsiao,

 

You should be able to apply the method used in the Generate Digital Pulse .NET C# Shipping Example to generate the first pulse from the PCIe-6323 on your button click in software. After that initial pulse, you could then transition to the loop that you’ve already described.

 

For your reference the shipping examples are located in the following locations:

 

XP:

Documents and Settings\All Users\Documents\National Instruments\MStudioVS201X\DotNET\Examples

 

Windows 7:

Users\Public\Documents\National Instruments\MStudioVS201X\DotNET\Examples

 

This particular example would then be located within the following directory: \Counter\Generate Pulse\GenDigPulse\CS

 

Alternatively, you could have your application generate a single pulse on startup and then transition into the loop.

 

Please let me know if that is helpful.

 

Regards,

 

Kyle S.
Applications Engineer
National Instruments
http://www.ni.com/support

0 Kudos
Message 4 of 8
(4,596 Views)

The camera output will be connecting to PFI0 on the PCIe-6323, and PCIe-6323 will be listening on PFI0. Do you suggest I wire a counter output to PFI0 as well? Isn't that going to damage the camera because when I geneate a pluse from that counter, the voltage will also go into camera through its output port?

0 Kudos
Message 5 of 8
(4,590 Views)

Hi Joehsiao,

 

I wasn’t suggesting that the counter output should be on the same pin. My understanding was that you had already figured out how to connect the camera to the PCIe-6323 and were simply trying to figure out how to generate your initial pulse from the PCIe-6323 to the camera in software.

 

The example I pointed you to simply shows how you can generate a single pulse in Measurement Studio by clicking a button on the user interface that generates an event that in turn executes the Counter Output task.

 

My understanding was that you wanted to connect the camera’s output to PCIe-6323 to act as a trigger for a pulse to be generated by a counter on the PCIe-6323 which would then connect to an input on the camera.

 

In order to determine the correct pinouts for your card you can right-click on the device in NI MAX and select “Device Pinouts.” This also lists the pinouts for each SRC, GATE, and OUT of all four of your counters. For example, CTR 0 OUT is PFI 12, according to this document.

 

Regards,

 

Kyle S.
Applications Engineer
National Instruments
http://www.ni.com/support

0 Kudos
Message 6 of 8
(4,587 Views)

Thanks for the reply Kyle. Your understanding of my application is correct.

I am not using Measurement Studio, just DAQmx to write my own C# program, but I assume they will work identically and I already figured out how to create pulses on a counter.

 

To explain my problem more clearly, let me layout the pin configuration on PCIe-6323, and how I configure them.

 

P1.0   - PFI0

CTR0 OUT - PFI12

CTR1 OUT - PFI13

 

The camera output is wired to the PFI0 pin.

 

Ctr0 is configured as counter output, it listens to falling edges on PFI0, which is P1.0, and generates pluses if that happens:

camShutterOutputTask.COChannels.CreatePulseChannelTime("Dev1/ctr0", "",
                   COPulseTimeUnits.Seconds, COPulseIdleState.Low,
                   0,
                   0.000001,
                   ((double)exposure_time) / 1e6);

camShutterOutputTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("/Dev1/PFI0", DigitalEdgeStartTriggerEdge.Falling);

My question is how to generate a falling edge signal on P1.0 (PFI0) via software.

 

I can use another counter, say counter 1, to create falling edges, but the signals will show up on PFI13, and the shutter only listens to PFI0.

 

 

 

 

 

 

 

 

0 Kudos
Message 7 of 8
(4,569 Views)
Solution
Accepted by topic author joehsiao

Hi Joehsiao,

 

 

How long are you expecting it to take from the time that the camera recieves the intial pulse until the time when the camera's out pulse arrives on PFI0? If it is a long enough time, then you could just reconfigure the task for counter 0 after the intial pulse. So, you intially configure it to  generate a pulse based on some one-time event (application start-up, user button event, elapsed time, etc.) and then once it generates that intial pulse, clear that task (or modify it), so that the counter output task is then configured to trigger the signal coming from PFI 0. 

 

Regards,

 

Kyle S.
Applications Engineer
National Instruments
http://www.ni.com/support

Message 8 of 8
(4,563 Views)