From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to trigger from analog input channel

I am using a BNC-2110 into a 6062E card. And I am sure this question has been posted several times but I was unable to find a clear answer. I am trying to use the devices ai0 channel as my trigger source. I tried using a voltage source in the trigger reference, and that almost works but it only works for several loops before coming up with an error. If someone knows what I may be possiblely doing wrong or where to find this information, any assistance would be great.
 
- there is always an easy way, but it is always the hardest to find
0 Kudos
Message 1 of 22
(9,332 Views)

Hello Beaton,

For a description of Analog Triggering and how to connect signals you can check out chapter 10 (page 2) of the E Series User Manual.

There are examples available in the Example Finder for both the Traditional DAQ and NI-DAQmx drivers.  To access these examples, open LabVIEW and go to Help» Find Examples...

For DAQmx (recommended):  Navigate to Hardware Input and Output» DAQmx» Analog Measurements» Voltage» *** There are a number of examples here that use analog triggers.  Depending on which type of trigger you want you can look at a different example.  The examples that use analog triggers will be named something like ____ Acq & Graph Analog ____ .vi You can read the description of each to decide which you need.

For Traditional DAQ:  On the Browse Tab, select Directory Structure and then navigate to daq» analogin.llb» Cont Acq&Graph (buffered) Hard A-Trig.vi

I hope this helps, and have a great day!

Brooks
Message 2 of 22
(9,305 Views)

Hello Brooks,

 

Sorry to bother you. Now I am also need to use the external analogue signal as a trigger to start the signal measurement.

In my case, there are 2 external analogue inputs, both are square wave. I want to use the BNC-2110 to firstly convert the analogue signal to digital signal. But I don't know how to convert them seperately as by using the DAQ assistant.vi, I can only convert them at the same time and I don't know how to seperate them then. Can you tell me how should I do in order to get the 2 analogue signals converted seperately?

 

Thanks very much for your help!

 

Regards,

Henry

0 Kudos
Message 3 of 22
(8,982 Views)

Hello henry Henry,

 

Are you basically wanting to input two analog signals and convert them into a digital signals or are you wanting to use analog signals as a trigger? If you just want to use analog signals as a trigger, Brooks' response points you to some good resources to do this.

 

If you want to convert analog signals to digital signals, you can start with an example. Open up example finder (help»find examples...) and then open Hardware Input and Output»DAQmx»Analog Measurements»Voltage»Cont Acq&Graph Voltage-Int Clk.vi. This shows you a basic way to collect analog signals without using DAQ assistant. To collect multiple signals, when you go to select the physical channel parameter, go to "browse" in the drop down menu, expand your device and hold CTRL to select multiple channels. In the loop, you will get an array of waveforms, and you can grab individual waveforms (separate them) by using the index array function (Programming»Array»Index Array). 

 

To convert the analog waveforms to digital you can use the analog to digital VI in the functions palette under Programming»Waveform»Analog to Digital.vi. This will convert the analog signals to a digital signal (I assume this is what you mean, since the signals are already technically digital since they get passed through an ADC in the DAQ card). I hope this helps!

 

-Nathan H

Software Developer
National Instruments
0 Kudos
Message 4 of 22
(8,965 Views)

Hello Nathan,

 

Thanks for your reply. The thing is I want to use 2 GPS receivers to synchronize 2 measurements. As you know, each GPS receiver will generate a pulse per second (PPS) and I want to use this PPS as the trigger source for the measurement to start. I have studied Brook's but it didn't help a lot.

 

Now I have the BNC--2110 and I saw there were trigger connectors in the board, named PFI1 and PFI2 respectively, so I want to take advantage of these 2 trigger connectors. But when I connect the PPS to each connector, I can't get anything out from the board. Do you know how should I do with the BNC--2110 board?

 

Thanks very much for your help!

 

Regards,

Henry

0 Kudos
Message 5 of 22
(8,957 Views)

Hey Henry,

 

The BNC-2110 is just the connector block. What card do you have the is interfacing this block with your computer? (should be a PCI or PCI-express card). Are the GPS receivers outputting digital signals that conform to TTL compatible logic levels (are the signals 5V or 0V with no more than 1.6mA of current)? If they are outputting a digital signal, then you can send these signals into any of the PFI lines to act as a trigger (or to the trigger lines). 

 

For example, if you would like to perform an analog acquisition each time the trigger hits and have an X series card, you can open up example finder (help»find examples...) and then open Hardware Input and Output»DAQmx»Analog Measurements»Voltage»Cont Acq&Graph Voltage-Int Clk-Retriggerable.vi. Then make sure your Trigger Source parameter is set to the same PFI line that you are sending your GPS signal to (on the BNC-2110, the trigger connections are really just PFI0 and PFI12, but these are common lines to use for triggers, but any PFI line will work). If you have an M series card, and cannot do retriggerable analog input, you can reference this example for how to use counters to workaround this limitation of our M series cards: https://decibel.ni.com/content/docs/DOC-6801

 

If your GPS signal isn't digital, and is some arbitrary analog square wave, you can use an example like this: https://decibel.ni.com/content/docs/DOC-4657 to use the analog value to trigger you're reading (you just need to set the appropriate window for your analog signal in the VI).  I hope this helps!

 

-Nathan H

Software Developer
National Instruments
0 Kudos
Message 6 of 22
(8,931 Views)

Hi Nathan H,

 

Thanks for your reply. The card I am using is M series PCI-6251. By the way, how can I know the output of my GPS receivers are analogue or digital?

 

And actually I don't know how to configure PFI1 and PFI12 to use them as the trigger source. And in the example you showed me, there is only 1 trigger souce configured, so can you tell me a little bit more about how to do the configuration for both of the channel?

 

Thanks very much!

 

Regards,

Henry 

0 Kudos
Message 7 of 22
(8,923 Views)

Hey Henry,

 

Unfortunately on our M and X series cards there is only one timing engine. This means that the analog inputs can only have one trigger (but you could put the digital inputs on a separate trigger). This is because the analog inputs need to share a timing source and this is also the reason you cannot have two separate analog input tasks going at the same time (they try to use the same resources and you get a 50103 error). However, you can have multiple sources be the trigger for just one analog input task by wiring them to the same PFI line, as long you don't create ground loops (and maybe put in some blocking diodes if you do this). 

 

If you need to read two analog input channels, they must be in the same task. For example, under the example I mentioned earlier, when you select your physical channel, you can go to browse, and hold CTRL to select multiple channels. If you want to have separate triggers for separate inputs you will need an additional card.

 

To measure the signal coming from the GPS, simply input the GPS line into one of your analog inputs and read the voltage values using any of the 'measure voltage' examples in example finder. Then you can connect a shunt resistor across the leads of the GPS output, and measure the voltage across the resistor to determine how much current is going through by using the equation current=Voltage/Resistance. 

 

-Nathan H

 

Software Developer
National Instruments
0 Kudos
Message 8 of 22
(8,914 Views)

Hi Nathan, 

 

Thanks for your reply. 

 

I also tried to sample these 2 signals at one task. The thing is when I finished the sampling, how can I seperate them? I mean, for example, A and B are 2 analogue input trigger signals. X and Y are the measurements to be taken. When I sampled the signal A and B at one task, how can I wire the signal A to control measurement X and signal B to control measurement Y?

 

Thanks very much for your help!

 

Regards,

Henry

0 Kudos
Message 9 of 22
(8,905 Views)

Hi Nathan,

 

Sorry to disturb you. Just I think I have found the solution. I can use the AI Sample Channels.vi to sample 2 channels at the same time and use the index array function to have access to each channel data. The thing is in this vi, what should I assign value for the device? It requires the device number of the DAQ I am used.  I have searched through the website, but failed to find anything useful. I am using a PCI 6251 which is shown in MAX as Dev1. Do you know what device number should I use?

 

I have attached the LabVIEW code I develped.

 

Thanks very much for your help!

 

Regards,

Henry 

0 Kudos
Message 10 of 22
(8,891 Views)