Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

external trigger analog input 6015

Solved!
Go to solution

Hi,

 

I have been able to setup my 6015 to accept an external trigger to start an analog input measurement (with a set # of samples and freq).  However, what i would like to do is to set it up so i can send a 20kHZ signal to the trigger, and each time the trigger detects the signal, the device would take one voltage measurement from each of two channels.  it would then save this on board memory and allow me to read the data later.  this is what i can not figure out how to do.

if it set it up such that i have an asynch callback and read the data after each pulse, this takes too long in my application.  I want to get a measurement for each external trigger pulse (the freq might vary higher or lower, so that is why i can not just set a freq - i need to use the trigger) and have this data saved in memory on the board for me to grab later.

 

Can this be done with the 6015?  another board?  if so, can you please show some code snippets in either VB.NET or C#.NET?

 

 

Thanks,

Joe

0 Kudos
Message 1 of 14
(4,747 Views)

Hi Joe,

 

It sounds like you need to use an external sample clock, not an external start trigger. NI-DAQmx includes a VB.NET/C# example of this: Analog In\Measure Voltage\AcqVoltageSamples_ExtClk. NI-DAQmx, NI-VISA and NI-488.2 .NET Example Locations explains where to find the NI-DAQmx .NET examples.

 

Since the sample clock rate will vary over time, be certain to tell NI-DAQmx the highest expected rate, so that the AI convert clock rate it chooses (used to multiplex the channels onto the 6015's one ADC) will be fast enough. Also, note that the 6015 doesn't have a very large buffer, so NI-DAQmx will transfer the samples into a buffer in your PC's memory as they are acquired.

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 2 of 14
(4,738 Views)

Brad,

 

thanks for the info.  you are correct: the external clock would be better.

 

If i am reading the sample code correctly, i can start the reading of the waveform with a desired number of samples per channel.  Does this mean that it will take this many samples per channel for every clock signal it gets, or does it mean that this will be the number of clock signals it reads until the call back is executed?  If it is the latter, that that is great.  If the former, then i still have a timing problem.  to grab the data in the callback from each clock signal, then start the read again in the call back will be too slow.  i dont think the code could keep up with the clock signals.

 (by the way, the example program description at the top says that it re-starts the waveform read again in the callback, but this is actually missing from the code in the callback).

 

Thanks in advance,

Joe

0 Kudos
Message 3 of 14
(4,729 Views)

Hi Joe,

 

The latter is correct. When the task is running, every time the 6015 detects a rising edge on the sample clock source, it will acquire one data point from each channel in the task. After samplesPerChannelNumeric.Value edges are detected, it will stop acquiring data. Since this is a hardware timed acquisition, you should not have any trouble keeping up with a 20 kHz clock.

 

Thanks for pointing out the error in the example program description. The part about re-starting the waveform read may have been copied from one of the continuous examples (such as ContAcqVoltageSamples_IntClk). I'll create a corrective action request so we fix the descriptions.

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 4 of 14
(4,727 Views)

Brad,

 

That sounds great.  I think this will work very well for me: i will give it a try over the next few days.

 

You mentioned that the buffer on the 6015 is not very large so it will copy to the PC's memory.  Since this is a USB device, will this affect my timing at all?  ( i am guessing the acquisition of the voltages triggered by the ext clock will not be affected).

 

Would i be better off using a PCI card?  If so, do you have a suggestion?  i need the 16 bit analog in, with at least the 200kS/s the 6015 has.

 

Thanks!

 

Joe

0 Kudos
Message 5 of 14
(4,710 Views)
Solution
Accepted by topic author jtaki

Hi Joe,

 

I think your application should work fine with the 6015. I only mentioned the buffer size because your previous post said "I want to ... have this data saved in memory on the board for me to grab later," and most of the devices supported in NI-DAQmx (including the 6015, PCI E Series, PCI M Series, and the new PCIe X Series) do not work this way. They continuously transfer data to a buffer in the host PC's memory throughout the acquisition, and they have enough onboard buffer to avoid buffer overflow/underflow errors at their maximum supported rates

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 6 of 14
(4,704 Views)

Thanks Brad.  Everything is working as you said...

 

Joe

0 Kudos
Message 7 of 14
(4,672 Views)

another question...

 

what is the preferred structure/archetecture if i have multiple readers/writers: is it ok to create as many tasks as needed, or should they all be under one task?

 

for example, if i have a multichannel reader that reads voltages with no external trigger, and i also have one that reads waveforms with the external clock, and i also have the digital inputs and outputs i am reading/writing.  should they all be in one class with one task?  one class with multiple tasks?  can i hvae multiple instances of the classes, or will this cause a hardware resource conflict?

 

just looking for the preferred architecture.

 

Thanks,

Joe

0 Kudos
Message 8 of 14
(4,652 Views)

Hi Joe,

 

The 6015 has a single AI timing engine, so you can only run one AI task at a time. You can run multiple DIO tasks simultaneously provided that they are all using different DIO lines.

 

As for whether to put different tasks in different classes, that depends on your application and is entirely up to you.

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 9 of 14
(4,628 Views)
Message Edited by EEsRULEtheWORLD on 08-31-2009 01:52 PM
Regards,

Sara Lewandroski
Applications Engineer | National Instruments
0 Kudos
Message 10 of 14
(4,617 Views)