Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

NI DAQmx, 6132: triggering and internal routing of the counter or digital output channel output to PXI trigger lines

We are using NI DAQmx for NI 6132 board in .Net environment.

We need to detect special condition on the input analog channel ( through the edge trigger or window trigger) and immediately after that generate specific pulse on the some of the PXI trigger lines.

 

Setting the Start trigger on the input channel - this we understand.

1. Generate a pulse, as I understand, we can do it by using Counter or Digital Output channel, right?

2. How we can synchronized triggering on one channel with pulse generation on another one in the same task

3. How  is possible to do internal routing of the counter or digital output channel to PXI trigger lines? I have seen 2 possibilities:

      - DaqSystem.ConnectTerminals(...)

      - COChannel.PulseTerminal Property- for counters only.

Which one of them doing device internal routing? What happened with default output: for example, for Counter 0 default terminal is  CTR 0 OUT , and used COChannel.PulseTerminal for specify output on the PXI_Star line, will signal appear on both terminals:PXI_Star and CTR 0 OUT  or only at PXI_Star?

Is usage of the  DaqSystem.ConnectTerminals(...) have exactly;y the same behavior, but covers digital output channels also?

0 Kudos
Message 1 of 11
(7,024 Views)

Hello,

 

      I am looking over this and I feel like the following example will help. 
      First off,  I recommend using the Digital Out line and not a Counter for the pulse generation.  I personally think it would work best.  both are possible and viable options.
      Second,  the following example (with changing Analog to Digital)  I believe would be a great way to synchronize the code that you have coming into either a Counter or Digital input.   The example is located at Users\Public\Documents\National Instruments\MStudioVS2010\DotNET\Examples\DAQmxWithUI\SynchronizeAIAOUsingDigTrigger.

 

Thank you

0 Kudos
Message 2 of 11
(7,016 Views)

We can't  use digital line here because we need to control the pulse length.
With Counter it is easier.

About examples: The best what I have already seen is at ...\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DotNET4.0\Synchronization\Multi-Function\SyncAIAO.
The recommended  example at
...\Users\Public\Documents\National Instruments\MStudioVS2010\DotNET\Examples\DAQmxWithUI\SynchronizeAIAOUsingDigTrigger is generally the same.

Based on example code, mine should be as it is shown at attachement (it is C# code).

Questions:

1. If we don't need to read samples at the AI channel, should we implement InputRead(....) function?
The input task which is using AI channel here is only used for generate trigger at "DIG1/ai/StartTrigger" as asoon as analog edge trigger is detected on the specified AI line.

2. Is it really required to create voltage channel on the AI line where we need to detect analog edge trigger?
Trigger definition as following

                 inputTask.Triggers.StartTrigger.ConfigureAnalogEdgeTrigger("DIG1/ai0", AnalogEdgeStartTriggerSlope.Rising, 0.5 );

is not enough? Again, we don't need to read samples at the AI (ai0) channel.

3. We have multiple modes of execution:

3.1 One pulse mode. It could be configured as the following, right?

  // Set up the timing
 inputTask.Timing.ConfigureSampleClock(string.Empty, 1000000,   SampleClockActiveEdge.Falling, SampleQuantityMode.FiniteSamples, 1);                
 outputTask.Timing.ConfigureImplicit(SampleQuantityMode.FiniteSamples, 1);

 

3.2  N-pulse mode .Receiving exactly N triggers and for each one generate a pulse and after trigger number N - stop tasks
It could be configured as the following, right?

   // Set up the timing
   inputTask.Timing.ConfigureSampleClock(string.Empty, 1000000,   SampleClockActiveEdge.Falling, SampleQuantityMode.ContinuousSamples, 1);                
   outputTask.Timing.ConfigureImplicit(SampleQuantityMode.ContinuousSamples, 1);               

and we need to stop both task as soon as N- pulses have been generated.

3.3  Continuous mode till explicit stop signal. This mode configuration is exactly as 3.2, the difference is that tasks stopping is done by special request

 

All what I need is clarification of these questions.

0 Kudos
Message 3 of 11
(6,989 Views)

Question 1:    Reading through the code I do not see it as being necessary,  but I was not able to certify 100%  that it is unnecessary for the trigger,   I would imagine you could comment that line of code and test from there.

Question 2:
    Repeat answer one, you will probably need to keep this one though.

Question 3:   I am not here to debug code, I would like to say that it looks correct as I was talking with my colleague that the code should work,   if you want more information you always have the following tool at your disposal.   Start » All Programs » National Instruments » NI-DAQ » Text-Based Code Support » NI-DAQmx .NET Framework 4.0 Help 

0 Kudos
Message 4 of 11
(6,983 Views)

The problem is that code does not work and we don't understand why.

0 Kudos
Message 5 of 11
(6,956 Views)

I'm going to go check out some hardware and try this on my computer.

0 Kudos
Message 6 of 11
(6,952 Views)

Question: What is default voltager level at PXI trigger line, High or Low?

0 Kudos
Message 7 of 11
(6,943 Views)

Rising edge,  by default the trigger will be on the rising edge.

0 Kudos
Message 8 of 11
(6,936 Views)

I have route the 6132 counter to the PXI_Trig5 line, using pulse terminal property,

and  connect this PXI line to the 5402 PFI1 terminal.

 

The default state of the voltage at PFI1 terminal is High.

I have tryed to send the pulse from counter (not through the analog trigger on the ai channel, but directly)  set the default level LOW, set timing fot he LOW and High state of the pulse generate it immeditely.

 

I shave seen strange behviour at 5402 PFI1 terminal: voltage at the beginning was HIGH, than came low for amount of time equal to the LOW state of the pulse, than came HIGH for amount of time equal to the HIGH state than to LOW for very short time and than HIGH ....

So default wqs HIGH, why is that?

0 Kudos
Message 9 of 11
(6,934 Views)

I am going to get someone from our team supporting FGEN to help out with this.

0 Kudos
Message 10 of 11
(6,925 Views)