Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering digital output

I want to set a digital line high during analog input measurement.
 
I can't find a way to do this, and I'm sure that there is a simple way.
 
I create a analog task and added a channel and created a digital task and created a digital output line.
For the analog task I configured the timing etc.
 
The analog task can be started with and without a trigger. Without a trigger I can just start the two tasks
right after each other. With triggering I don't know when the analog task starts.
 
My best guess was to configure a start trigger for the digital task like this:

DAQmxErrChk( DAQmxCfgDigEdgeStartTrig(s_hTaskDig,"/Dev1/ai/StartTrigger",DAQmx_Val_Rising) );

Using the start trigger signal from the analog input task. But this is not accepted?
 
 
 
Should I call this:

DAQmxErrChk( DAQmxWriteDigitalScalarU32(s_hTaskDig,FALSE,0,1,NULL) );

before or after the DAQmxStartTask?
 
Please help!
 
-cpede
0 Kudos
Message 1 of 10
(4,428 Views)

I tried calling

DAQmxErrChk( DAQmxCfgSampClkTiming(s_hTaskDig,"/Dev1/ai/StartTrigger",1.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,1)  );

on my NI6143 board, but it fails saying that it only support DAQmx_Val_OnDemand?

Please help  Smiley Sad !!!!

-cpede

 
0 Kudos
Message 2 of 10
(4,413 Views)

You could try this:

1. Create a pulse generation counter output task. Use units of time and create a single pulse that is high for the desired duration of your analog input. This pulse will appear at the I/O connector on some default pin that you have to look up. Or you can specify the output terminal.

 

2. Create your analog input task such that it uses a digital level Pause trigger. Set the Pause When attribute to pause when Low. You can just set the sample mode to Continuous. The analog input will only run while the pulse from the counter task is high.

0 Kudos
Message 3 of 10
(4,406 Views)
I forgot to mention that the Source of the digital level pause trigger should be set to the InternalOutput terminal of the counter used for the pulse generation. If you use Ctr0 than this source is Ctr0InternalOutput.
0 Kudos
Message 4 of 10
(4,405 Views)

Thanks for the reply.

What you describe is how to control the AI from a digital pulse.

What I'm interested in is simply to make port0/line0 go high while the AI is running.

There must be a simpler solution.

-cpede

0 Kudos
Message 5 of 10
(4,390 Views)
Please help!
0 Kudos
Message 6 of 10
(4,371 Views)
Hello cpede,
                    I've used PCI-6115 and BNC-2110 for my experiments. I've used LabVIEW 7.1. According to what I've understood, you wish to have a triggered acquisition. If you wish to start capturing the analog signal with a digital trigger, all you have to do is connect the trigger to PFI0 pin available on BNC-2110 and on the LabVIEW side set the inputs on the AI START according to what you wish to use (for e.g. rising, falling, no edge). Also connect the analog signal input to any of the available AI channels available on your BNC-2110. Now, you are all set to start capturing analog signal with a digital trigger. Let me know if you still have any doubts. Since I've worked on this and managed to used this successfully, I thought of sharing my knowledge. I hope this will help you  if you are using BNC-2110 to capture the analog signal and PCI-6115 (you can sample at 10Msps) as your DAQ board. Good Luck!
0 Kudos
Message 7 of 10
(4,370 Views)

Thanks for the reply,

What I want is to start both a analog input and a digital output using a digital (or analog) input trigger.

The digital output should only go high during the analog input operation which is limited by number of samples acquired (DAQmx_Val_FiniteSamps).

Time: ________S____________________T_______________ACQ_______________END_____________

Action:       StartTask                          Input Trigger              Acquire AI             Num. of samples acq.
                  Wait for trigger                  Trigger happens      Acq running                       Acq stopped

Digital                                                        ___________________________________                                          Hi
Output___________________________I                                                                       I__________________     Low

 

-cpede

0 Kudos
Message 8 of 10
(4,365 Views)

Could anyone show me how to make this happen, please?

-cpede

0 Kudos
Message 9 of 10
(4,345 Views)

While some of our boards have what we call 'correlated digital I/O', where you can clock out digital data by using your ai/sampleClock for example, I don't think this feature solves your problem. You could use the ai/StartTrigger as your clock, but it only ticks once. I don't think the board emits a signal upon completion of a finite analog input acquisition. Even if it did, you can't switch from one clock to another for your correlated digital output while it's running.

Here's a suggestion involving counters again.

1. Configure a counter output: pulse generation: ticks channel . Configure its idle state to be low. Configure the minimum number of low ticks, which is 2.

2. Configure the source of ticks to be the ai/SampleClock. Configure the number of high ticks to be the number of samples you are acquiring. You may want to subtract the number of low ticks from this.

3. Configure a Start Trigger for your counter pulse generation task. Configure the source for the Start Trigger to be ai/StartTrigger.

4. If you don't like (or know) the default output terminal of the counter pulse, configure a different output terminal.

That should give you *almost* what you want. I say almost because the pulse will go high not immediately upon arrival of the Start Trigger but a number of sample clocks later (equal to the value of the low ticks you used in step 1).

Good luck.

 

 

 

 

0 Kudos
Message 10 of 10
(4,336 Views)