Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

analog trigger on BNC2120 / PXI3-6361

Solved!
Go to solution

Hi there,

 

I am trying to run an analog trigger (falling edge) on a BNC2120 breakout connected to a PXI3-6361 module (X-series device). From what I have read in the 2120 Installation guide (pg 8), I should be able to use PFI 0/P1.0 (which I think is the BNC connector in the very top right hand corner of the box)  with DAQmx Start Analog Edge. Curiously, Labview does not provide a dropdown menu to select an appropriate trigger source, so for this option I typed in the trigger source "PXI1Slot2/port0/line1". When I do this, I receive an error:

 

Error -200265 occurred at DAQmx Start Task.vi:3
Possible reason(s):
An attempt has been made to use an invalid analog trigger source.
Ensure that the trigger source you specify matches the name of the virtual channel in the task or matches the name of a non-scannable terminal that the device can use as an analog trigger source.
Property: Start.AnlgEdge.Src
Corresponding Value: PXI1Slot2/port1/line0
Valid Choices: V1, APFI0
Task Name: _unnamedTask<6A>

I therefore then tried "APFI0" as the trigger source and received this time-out error:

 

Error -200284 occurred at Acq&Graph Voltage-Int Clk-Analog Start w Hyst.vi

Some or all of the samples requested have not yet been acquired.
To wait for the samples to become available use a longer read timeout or read later in your program. To make the samples available sooner, increase the sample rate. If your task uses a start trigger,  make sure that your start trigger is configured correctly. It is also possible that you configured the task for external timing, and no clock was supplied. If this is the case, supply an external clock.
Property: RelativeTo
Requested Value: Current Read Position
Property: Offset
Requested Value: 0
Device: PXI1Slot2
Task Name: _unnamedTask<69>

 

 

Can anyone offer some advice as to how to achieve an analog voltage trigger with this combination of devices?

 

Thanks,

Claire.

0 Kudos
Message 1 of 26
(4,972 Views)

Hi Claire,

 

The reason you are getting the second error (200284) is because the DAQmx task isn't actually receiving a trigger from the APFI0 input line. The APFI0 input pin is a special trigger pin that can be used as an analog trigger source. However, the APFI0 line isn't actually accessible using the BNC-2120. To access the APFI0 pin (which is pin 20 on the PXIe-6361) you would have to use a different connector block such as the SCB-68 which gives you direct access to each pin on the DAQ board.

 

So essentially you want to trigger an analog input acquisition with an analog trigger source, correct? To do so, you have two options using the PXIe-6361. The first is to use the APFI0 input terminal as the trigger source. However, this option is unavailable using the BNC-2120.

 

The second option is to use the AI channel from which you are acquiring data as the analog trigger source. You specify a voltage level and when this level is reached the task is triggered to begin. Because your AI signal and the AI trigger are going to be two separate signals (well, that's what I'm assuming at least), your DAQmx task will need to acquire from two AI channels. One AI channel will be a "dummy" input that is used only for the AI start trigger. The second channel would actually carry your AI signal.

 

For example, connect your AI trigger source to AI0 and your signal to AI1 on the BNC-2120. Then, have your DAQmx AI task acquire from both channels. For the DAQmx Start Trigger (Analog Edge) VI, set the "source" input string as "<PXIe-6361 DAQmx name>/ai0". The DAQmx task will continue to acquire from the ai0 trigger input, but you can essentially just throw this measurement data away since all you want is the data on ai1.

 

This information is available in the X Series User Manual starting on page 11-2.

 

Hopefully this helps!

 

Chris G

Applications Engineer
National Instruments
0 Kudos
Message 2 of 26
(4,963 Views)

Hi Chris,

 

Thanks for your response. I understand now about the incompatibility of the 6361 and the 2120 units. It's disappointing, but I'll work within the limitations.

 

I have tried your idea of using an analog channel as a trigger. Unfortunately I can't get it to work properly. I know that the channel I'm using is  definitely providing a suitable falling voltage (5V to 0V) signal because I have collected the signal in MAX.

 

Perhaps you could take a look at the attached VI and see if the problem is with my VI rather than the hardware in this instance. When I run the VI it just sits and waits for the trigger, before eventually timing out. No error is given until the timeout occurs.  I have made sure that the task (AI voltage) that is performing the trigger is called first in the task list for the 2120/6361 device.

 

Do you have any idea where I might be going wrong?

 

Thanks for your help,

Claire.

0 Kudos
Message 3 of 26
(4,951 Views)

Hey Claire,

 

First, a quick aside... When you post/email code, it's always a good idea to set all the controls on the front panel to the values you are using, and then save those values as the default values (Edit >> Make Current Values Default). Then others viewing the code know exactly what values you are using. Just a helpful tip.

 

Assuming you you have the values set as default, the analog trigger source is set as the APFI0 line, but as discussed earlier you cannot access this line using the 2120. If you are changing this, the source should be "<daqmx device name>/ai<channel number>"

 

I've quickly modified a LabVIEW shipping example to use an analog channel as the trigger source (see attached). The trigger signal I was using is a +/- 1V sine wave, so I have the trigger level set as -0.5V. In this example, I used ai1 as the analog trigger source (this is the channel I had the 2 V pk-pk sine wave connected to). My signal is then coming through on channel ai8 (although I'm not actually reading anything so it's a noisy 0 V signal). The graph shows both the trigger signal and the data signal.

 

If you are using a 5 to 0 V falling edge as the trigger, you might want to set the trigger level at around 0.5 V, just to be sure that the level is reached. If you set it as 0 V, there is a chance the signal may not actually reach exactly 0 V, so it wouldn't ever trigger the acquisition.

 

Try running a simple example similar to mine to see if you can get it to work. Then try incorporating this in your larger program.

 

Hopefully this example helps clarify. If not let us know and hopefully we can figure out exactly what might be going wrong.

 

Chris G

Applications Engineer
National Instruments
0 Kudos
Message 4 of 26
(4,944 Views)

Hi Chris,

 

Thanks for your reply and the hints. I have attached the VI again with the default values set.

 

I have tried your modified example and it works well with both the Channel Parameters and Trigger Parameters channels set to "PXI1Slot2/ai0".

 

When I use this channel ("PXI1Slot2/ai0") in my VI the trigger does not work.

 

Comparing your example with my VI, the differences are:

(1) more than one voltage channel in the task

(2) use of a true/false selection on the external trigger

(3) master-slave synchronisation loop (adapted from a shipping example)

(4) use of ai/start trigger and multiple start digital edges (adapted from the same shipping example from memory)

 

Perhaps one of these is causing the problem?

 

Thanks for your continued help.

 

Claire.

 

0 Kudos
Message 5 of 26
(4,937 Views)

Hello ClaireJ,

Looking at the VI, I saw that you use DAQmx Create Channel VI several times after setting the trigger,

Why is that? I think it is a good idea to keep the same block organization from the example.

Have you tried to use one single DAQmx Create Channel VI to create all the Analog Input Voltage channels at the beginning?

Mr.O
Applications Engineer
National Instruments
0 Kudos
Message 6 of 26
(4,926 Views)

Hi Mr O,

Thanks for your comment.  I'm not sure why I do it this way, I guess so that on the Front Panel its very clear which Physical Channel corresponds to each incoming data stream.  I have tried modifying the VI as you suggest (only 1 Create Channel (voltage) block) but unfortunately this doesn't change the lack of response to the trigger signal.

Cheers,

Claire.

0 Kudos
Message 7 of 26
(4,914 Views)

 

ClaireJ,

 

even if it doesn't solve your triggering problem, it is important to create te channels before set a trigger.

I think this is a good first step.

So, how does it looks now? Do you mind to attach a screenshot?

Mr.O
Applications Engineer
National Instruments
0 Kudos
Message 8 of 26
(4,908 Views)

Hi MrO,

 

Here is a screenshot showing just the area that I modified. In an earlier version I had 4 AI Create blocks prior to the Trigger, but I then shifted the trigger to directly after the first AI Create as I thought this might fix the trigger problem.

 

Do you think its something to do with the master-slave trigger synchronisation section? I adapted that from the example "Multi-Device Synch-Analog Input Acq-Ext Dig Start.vi"

 

Thanks,

Claire.

0 Kudos
Message 9 of 26
(4,905 Views)

Hi Claire,

Now it looks much better!

I was looking at the example "Multi-Device Synch-Analog Input Acq-Ext Dig Start.vi"

that you are using as a reference, and I think that could be a good idea to run a test

first with the example as it is, and once it works fine you can start modify.

Be careful with references (ground) so the device is able to recognize the analog edge

you are trying to use as a trigger.

Mr.O
Applications Engineer
National Instruments
0 Kudos
Message 10 of 26
(4,876 Views)