Data acquisition from analog start trigger to analog stop trigger

Hi,
I'm trying to start and to stop a data aquisition by using an analog input trigger. I'm using NI-USB-6251. At input channel ai0 is a sin-signal connected. At input channel apfi0 is an analog trigger signal connected. I can start the trigger signal by pushing a button on my frequency generator. Here's a part of my code:
Hi,
ich versuche eine Messung mit einem analogen Eingangssignal zu starten und zu beenden. Ich benutze die Messkarte NI-USB-6251. An Eingang ai0 ist ein Sinus-Signal angeschlossen. An Eingang apfi0 ist der Triggereingang angeschlossen. Das Triggersignal löse ich immer per Tastendruck auf dem Funktionsgenerator aus. Hier ist ein Teil des Quellcodes:
TaskHandle taskHandle = 0;
int32 read;
float64 *data;
float64 sampleRate = 1000; //Samples per Channel per Second
uInt64 sampsPerChan = 4000; //Samples per Channel to read
int sumOfChan = 1;
double triggerLevel = 2.0;
double min = -0.2;
double max = 0.2;
double timeOutReadAnalog = 10.0;
void calculate()
DAQmxCreateTask("", &taskHandle);
DAQmxCreateAIVoltageChan(taskHandle, "/dev1/ai0", "", DAQmx_Val_Cfg_Default, min, max, DAQmx_Val_Volts, NULL);
DAQmxCfgSampClkTiming(taskHandle, "", sampleRate, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, sampsPerChan);
DAQmxCfgAnlgEdgeStartTrig (taskHandle, "/dev1/apfi0", DAQmx_Val_RisingSlope, triggerLevel);
DAQmxCfgAnlgEdgeRefTrig (taskHandle, "/dev1/apfi0", DAQmx_Val_RisingSlope, triggerLevel, 3000);
DAQmxStartTask(taskHandle);
if( (data=malloc(sampsPerChan*sumOfChan*sizeof(float64)))==NULL )
MessagePopup("Error","Not enough memory");
//set start and stop trigger
//set breakpoint here
DAQmxReadAnalogF64 (taskHandle, -1, timeOutReadAnalog, DAQmx_Val_GroupByChannel, data, (sampsPerChan * sumOfChan), &read, NULL);
I've choosen the sample rate (1000/s) and the samples per channel (4000), that the aquisition needs 4 seconds to be complete. I can start the aquisition by Start-Trigger, but I think I have a problem with the function DAQmxCfgAnlgEdgeRefTrig. Actually the array will always be filled with 4000 values. I thought I can start the aquisition by triggering once and e.g. after two seconds triggering again for stopping aquisition with result of 2000 values in the array. I hope you can help me with this problem.
Ich habe die Sample Rate (1000/s) und die Samples pro Kanal (4000) so gewählt, dass die Aufzeichnung 4 Sekunden dauert. Ich schaffe es auch die Aufzeichnung über den Trigger zu starten, jedoch funktioniert das Stoppen mit der Funktion DAQmxCfgAnlgEdgeRefTrig nicht. Aktuell ist es so, dass das Array immer mit 4000 Werten gefüllt wird.
Ich hatte mir erhofft, dass ich durch einmalige Triggerung die Messung starten kann und beispielsweise nach zwei Sekunden erneut triggere und die Messung damit stoppe und dann nur 2000 Werte eingelesen habe.
Ich hoffe, ihr könnt mir dabei helfen.

Hi Martin,
I looked over your code and noticed that you called the function without checking the returnvalue.
Try to change the line to the following:
First: define a new int32 value and call it for example: errorcode
Second: The function returns a status code, wich if it fails, includes an error code so save this code in the new generated value
errorcode = DAQmxCfgAnlgEdgeRefTrig (taskHandle, "/dev1/apfi0", DAQmx_Val_RisingSlope, triggerLevel, 3000);
and try to run the programm and read out this value.
If you got this value, please post it here and I will try to help you if I can.
Regards
Philipp

Similar Messages

  • Triggering a 6024E into data acquisition from start and end number of finite pulse generator from a 6602

    My motion control system is driven by a 6602 I wanted to acquire analog current (to a voltage via I/V converter) from a 6024 AI when:
    (1) At the start of the pulse generation
    (2) Stop at the end of the pulse generation
    (3) Read every possible data between and stream it on the harddisk
    (4) Option to skip at regular intervals to reduce amount of data accumulation
    Anyone have some suggestions? What I did try and attempted was to "loop an AI from a triggered intermediate Analog Input VIs" this is rather erratic!My question for the analog input software are:
    (1)Can you trigger an AI to start a continuous acquisition?
    (2) How do you do AI from a "start" p
    ulse train to "end" pulse train?
    (3) How do you manage time for File I/O meanwhile doing (1) and (2) above?
    Bernardino Jerez Buenaobra
    Senior Test and Systems Development Engineer
    Test and Systems Development Group
    Integrated Microelectronics Inc.- Philippines
    Telephone:+632772-4941-43
    Fax/Data: +632772-4944
    URL: http://www.imiphil.com/our_location.html
    email: [email protected]

    "(1)Can you trigger an AI to start a continuous acquisition?
    (2) How do you do AI from a "start" pulse train to "end" pulse train?
    (3) How do you manage time for File I/O meanwhile doing (1) and (2) above?"
    Answer 1 and 2)
    Yes you can, This VI is part of the search examples that ships with LV:
    "Continuous Acquisition & Graph Using Digital Triggering and External Scan Clock
    Demonstrates how to continuously retrieve data from one or more analog input channels using an external scan clock when a digital start trigger occurs."
    Go to Search Examples in the Help/Contents of LV. Then pick I/O Interfaces/Data Acquisition (DAQ)/Analog Input/Triggering an Acquisition/Triggering a Continuous Acquistion.
    This VI is appropriate ifs you want to clock the DAQ with some clock (external scan clock) other than the on board clock.
    The start trigger required by the DAQ card will be a TTL signal attached to the PFI0/TRIG1 pin of you DAQ card (via whatever signal conditioning you have).
    The external clock also needs to be TTL and is attached to the PFI7/STARTSCAN pin.
    You tell it which AI channel to use and wire that up appropriately.
    All of this stuff is in the context help for the VI.
    Answer 3)
    You have a misconception of how the acquisition makes its way into a file on the hard disk. You don't really "stream to disk." The VI above will run a buffered acquisition. The DAQ card sets up a buffer that fills with the data continously. When you use the VI you set up how the buffer is configured, you will see controls for buffer size, number of scans to read at a time, etc. The acquisition runs data into the buffer continously and reads from the buffer are a parallel process where chuncks of the buffer are extracted serially. You can end up with a scan backlog where the reads are falling behind the data. Making the buffer bigger helps. All of this is limited by the sampling capability of the DAQ card. 200kSamples/second is for one channel of AI. Divide by 2 for 2 channels. etc.
    The short answer is that the VI and DAQ card manage the file I/O for you.
    The VI above writes the scan out to the waveform chart on the front panel. You will want to wire that data out from the AI Read Sub VI to a spreadsheet file in tab delimited form or similar.
    Look inside the VI block diagram. There is a While loop containing the AI Read. Every time the loop runs (unless you hit STOP), the AI Read plucks the specified # of scans from the buffer (starting from the last unread datum). If you wire the double orange wire from AI Read out of the loop (and set the tunnel for Auto Indexing) the Vi will build another buffer in memory that is a series of AI Reads appended to each other, a sequencial record of the acquisition. Here you put in a Write to Spreadsheet VI. This is in the Functions Pallete, it is the first VI in the File I/O Pallette (icon looks like a 3 1/2 disckette).
    There is more to it than this. The spreadsheet Write is 1D or 2D only. By running the array out of the while loop with auto indexing enabled, you create a 3D array. (If you turn off auto indexing you will only get the last array performed by the AI Read.) You will need to create a new array withe the pages of the array placed serially into a 2d array. I don't think I want to get into that. It isn't that bad to do, but you should get some time messing with arrays on your own, then you will see how to do it yourself. One solution is to only run the While loop once with a buffer big enough to hold the whole acquisition, or in other words no loop at all. I don't know how many scans you want. The other thing is by wiring that AI Read out of the loop you are creating an array that must be dynamically resized as the loop runs. Kind of a no no. Better to know what you are acquiring size wise and letting the VI set up buffers and array space that does not need to be changed as the program runs.
    Caveat: I am fairly new to this and I could be wrong about the arrays and buffers and system resources stuff. However, I have done essentially what you are trying to do succesfully, but not "continuously." I limited the AI Read to one large read that gets what I need.
    "Continously" is usually reserved for screen writes as in the VI above. The computer is not required to continually allocate space for an ever expanding array to be written as a file later. Each time this VI runs the While Loop the data goes to the waveforn chart. Each new AI read overwrites the previous one. Sort of like if you turn the Auto Indexing off. When the VI stops, the waveform chart on screen would show the same data as was written to the spreadsheet.
    Feel free to email me directly: [email protected]. I will help as I can.
    Mike Ross

  • Data acquisition from multiple channels.

    Hello
    Right now, I am able to acquire the signal from a single load cell and display it.But I would like to know of how to acquire  acquire signals from two load cells simultaneously.I am using Labview 6i and I am using AI S-Scan with AI config to acquire the waveform.It would be of great help if you could suggest a simple method to acquire the signals.
    PS: Please find the attached file used for acquisition from a single load cell.
    Looking forward for your reply.
    Manasa
    Attachments:
    test 4.vi ‏102 KB

    Hi Manasa,
    If I understand what you are trying to do, it is relatively
    straightforward to configure your application to acquire data on two channels.
    I was unable to run your vi as it was missing some of the subVI’s
    from your application.  However, your
    attachment was sufficient to see what you are trying to do. 
    Here is how to add channels:
    1.      
    In the I/O Channel Constant, you can add
    additional channels by using a comma or a semi-colon.  For example, to scan the first four channels
    you would put 0:3 in the constant (see attached screenshot ChannelConfig.jpg).  To scan the first and third channel you would
    put 0,2.
    2.      
    The AI Single Scan VI will now read from
    multiple channels.  Often it easiest to
    configure the output of this VI for viewing by first putting the data into an
    array using the Build Array VI.  It can
    then be plotted in a waveform graph. (see attached screenshot ReadtoGraph.jpg
    and WaveFormGraph.jpg)
    Just a few notes about “simultaneous” sampling:
    Most of the NI data acquisition cards have a multiplexer
    between the various input channels and the Analog to Digital (A/D) converter
    creating a very small delay between each channel (usually ms range or
    smaller).  NI does make several data acquisition
    cards that can perform true simultaneous sampling, meaning that there is an A/D
    converter for each channel.
    For the large majority of applications, the small delay
    between channels is negligible.
    Jared T.
    Attachments:
    ReadtoGraph.JPG ‏21 KB
    ChannelConfig.JPG ‏288 KB
    WaveFromChart.JPG ‏61 KB

  • How to synchronize the data acquisition from both GPIB and DAQ card

    I want to begin/stop acquiring the data from GPIB and PCI6024E card into Labview at the same time. Since the acquisition from GPIB is quite slow comparing to the one from DAQ card, I can not put both of them in the same loop structure. Is it possible to synchronize them?
    Thank you!

    Hi,
    I wanted to save data acquired from NI-DAQ (for example, NI 9234) in a file using the DAQ-mx ANSI C Code. The response I got was as follows:-
    One way to do it is with TDMS logging. DAQmx comes with functions designed to log to a TDMS file. This is a special file type that is used for collecting data in a logical format. It can be displayed in a TDMS viewer where data is separated into groups and channels. NI-DAQmx provides examples for how to log to TDMS. Look at the TDMS examples in the C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage directory.
    However, now I want to know is there a way that using that same C code, can we save the data in a .txt file format (Text File) instead of a TDMS file? We actually want to access that file through MATLAB (that's why we want to save it in text format).
    Also on an other note, is there a way we can access & open TDMS files by MATLAB?
    Thanks,
    Sauvik Das Gupta

  • Data acquisition from NI PXI 5152 using LabVIEW

    Hi,
        This might be really stupid question, I am new to LabVIEW and the Digitizer equipment. I was wondering if there are already any labVIEW based application available to read the data from PXI5152. I would be using both channels available and may be trigger. If there is no such application available, what would be port numbers I would be using for data acquisition. But, If I am to develop an acquisition software, I would be looking at every single specification of the equipment. I am assuming the output will be a digitized signal varying with the clock input, since It is used as oscilloscope. When working with labview how would I specify the port to read from and how would my PC recognize the port. I working on a pre-configured system and they won't let me unplug anything to check the configuration. Does NI provides a software to read into the signal fed into the channel and trigger inputs. I have tried looking into the different forum discussion but didn't find any that address my issue. May be it's too simple and stupid. But, it would be a great help if you could point out my misunderstanding.
    Thanks in advance.
    BP

    There are numerous examples. Help>Find Examples> Modular Instruments>Ni-Scope. There is a test panel available in MAX. On the Measurement I/O>NI-Scope palette, are all of the driver functions includeing the NI-Scope Express.
    I'm not quite sure I understand your references to 'port's. Once installed into the chassis, it should be listed in MAX. In the functions you will be using, there will be a dropdown menu that you will be able to select the scope resource name.

  • Data acquisition from switching 500lbs load cell to 100lbs load cell

    I am using 500lbs load cell, and acquiring data by inputing 2volts from 2345 signal conditioning board, and sensor output is connected to SCC-AI03 pin 3 and 4 , and configure this load cell to a channel using NI MAX, data neighborhood, traditional NI-DAQ virtual channel, the physical quantity is voltage set at range -10 to 10, and sensor also set at voltage with no scaling, but, I couldn't get any signal when 100lbs load cell is use, the difference of this 100 lbs load cell is the rated output is at 2.958mV/V, while the 500lbs rated at 1.8295mV/V , how should I do this?
    Thanks.

    Hi,
    At this point, it is difficult to determine exactly what is happening to your acquisition. Could you please provide some additional information by answering the following questions:
    What voltage are you reading with the 500 lb load cell?
    Would it be possible to connect your load cells to a DMM and see what voltage reading you receive? If so, what do you see?
    What is specifically happening when you connect the 100 lb load cell?
    I also noticed that you are using the Traditional NI-DAQ (Legacy) driver. I recommend upgrading to the NI-DAQmx driver.  Here are a couple of links with more information about DAQmx:
    Advantages of NI-DAQmx:
    Transition from Traditional NI-DAQ to NI-DAQmx:
    Learn 10 Functions in NI-DAQmx and Solve 80% of Data Acquisition Applications:
    Regards,
    Hal L.

  • Data acquisition from SPCM-AQRH-15 and Nano-ViewTM 200-2/M

    I am trying to acquire data from APDs (PerkinElmer, SPCM-AQRH-15) and Nanopositioner (Mad City, Nano-ViewTM 200-2/M). The second equipment has USB 162 or 202 digital interface integrated but I am not sure abut the first one since I am still waiting my order. anyway, I want to control/communicate with both of them using your product, does anyone know what software and hardware I need? thanks.
    Solved!
    Go to Solution.

    Hello Confuciusl,
    I have been looking into the problem
    statement that you gave us above and have some questions for you as well as
    some answers. I am going to go with the basic understanding that we will be
    using LabVIEW to not only communicate with your devices, but also for data
    acquisition and analysis.
    In reference to your APDs (PerkinElmer,
    SPCM-AQRH-15), I have looked at the data sheet for the product located here,
    and have determined that the best method of communication with your device
    would be to use some type of Counter/Oscilloscope card in a PCI/PXI standard.
    This will allow for proper recording of your signal from your Output Terminal.
    For more information on cards please refer to this link.
    As for the second instrument listed, the
    Nano-ViewTM 200 from MadCity, it mentions here that The Nano- View/M™
    system includes the Nano-Drive™ controller and is compatible with user written
    LabVIEW software. Since we do not have the capability to obtain the product you
    are specifically trying to communicate, the best option at the moment would be
    to try and contact MadCity and see if they have any specific Instrument Drivers
    pre-built for LabVIEW that will allow you to communicate with your device. If
    they do not, the next option would be to develop your own by following the
    guidelines at the following link.
    Thanks again and have a great day!
    Regards,
    Nicholas K
    National Instruments
    Applications Engineer

  • I have a brand new macbook pro that i was doing a data transfer from an old macbook, it got stopped/cable pulled out, now have spinning wheel of death that wont stop, how do i reboot/stop the wheel of death and start again?

    i have a brand new macbook pro that i was doing a data transfer via firewire from an old macbook, it got stopped/cable pulled out, now have spinning wheel of death that wont stop, how do i reboot/stop the wheel of death and start again? (this time il use time machine transfer)

    Just power off the machine(s). Shut them down. Migration Assistant gets 'stuck' sometimes - best way to migrate really isn't over Firewire, though it will certainly work, but with both machines hardwired via Ethernet to the same router. You can use a TM backup, too, of course, provided that it's recent. Which is the best? Your choice. I've done it both ways and have a preference for MA, but TM restore can be a bit faster and less quarrelsome.
    Clinton

  • Sample VI's for data acquisition from SR850

    Hi,
    I was helped a lot by NI in finding driver for our instrument,SR850. I've
    installed its driver and need some sample VI's for its data acquisition. I
    am a
    beginner in Labview and getting data from SR850 is creating a lot of
    trouble
    for me at the moment. We have Labview 7.1 installed on our computers in
    Linkoping university.
    Your help in this regard will be highly appreciated.

    Actually i have to plot all of SR850's outputs(X,Y,R) vs. time and save corresponding data on a PC,but i am unable to write its VI. Hope to hear from u soon

  • Data acquisition from SR 530 lockin

    Hello,
    I need to read the output of the sr530 vector lockin and store them in a file.
    I was wondering if there is any driver which will let me read frequency, output amplitudes & relative phase between the input & output signal!
    Any help will be much appreciated!
    Thanks a lot,
    Ashutosh.

    Thanks a lot for the help Matt.
    I can connect the device via GPIB. Let me tell you a bit more about the problem. As of now I was using a single channel lockin, EG & G 5209, to read the data(so I am kindda familiar wtih data acquisition... not much though). And the only thing I was reading was the output amplitude of the lockin.
    Now I have to use the vector lockin, SR 530, and I will need to read both the output amplitudes, the phase & the frequency (all four of them)at the same time. And I am looking for a driver which can do this, i.e. which can read all four data simultaneously & store the result in a *.txt or *.dat file.
    Do we have something like that?
    Thanks,
    Ashutosh.

  • Data acquisition from a 250N Load cell

    Hi ,
    I am very new at using the Labview.I am using Labview 6i(PCI 6052E).The load cell(250N) is connected to a pump.The pump has 2 bags.One of them is filled with water and the other is empty.I want to load the bag which is empty from the bag filled with water using the pump.The load cell is connected to the bag which is filled with water.I am trying to aquire a volatge signal continously from a load cell and display it on a chart.
    My program has no errors and I am able to run the progam.But it is not aquiring any signal.Could u please help me out.Attached is my code for the same .
    -Manasa

    Hi Manasa,
    Make sure you are handling your errors in your code. You can do this by wiring your error clusters through your VI and then terminate them in a General Error Handler VI. If you are doing this, make sure that your device works in Measurement & Automation Explorer (MAX). Do this by opening a test panel and verifying that you can get a known voltage (like a battery) to read correctly. If you can successfully get a voltage in MAX, try running one of the example programs. You can find them at Help » Find Examples..., then browse to hardware input and output. If you can get an example program that is similar to what you are trying to do to work, try comparing your code to the example.
    Please post back if you have any questions. Have a great weekend!
    Ryan D.
    District Sales Manager for Boston & Northern New England
    National Instruments

  • Stop trigger, how to specify the analogy trigger channel?

    Dear All,
    In fact, I am using DAQ2204 cards from ADLINK, which is more or less equivalent to NI E-series muttifuntion board. However, I have some problems with regard to my data acquisition program. Basically, it is about a middle/stop trigger application, which means data acquisition will be starting once the specified analogy channel (for example, channel 0) exceeds a prescribed value.And, data both before and after trigger will be acquired. However, I do not quite understand how to physically make the I/O connection and specify the analog trigger channel and level.
    According to the board User's Guide, 'SRC1 can be used for all trigger modes while SRC2 can only be used for post and delay trigger modes'. I have come across similar description with NI examples before. It would therefore be very appreciated if anybody can help. Thanks in advance.

    Hi dragondriver,
    I'm providing below links to 2 documents that discuss wiring considerations that are applicable to your device.  Hopefully this information is helpful!
    E Series User Manual
    http://www.ni.com/pdf/manuals/370503k.pdf
    Field Wiring and Noise Considerations for Analog Signals
    http://www.ni.com/white-paper/3344/en#toc5
    Josh B
    Applications Engineer
    National Instruments

  • Data Acquisition on a 20MHz Timebase with PCI-6110

    I would like to acquire a data point (viz a voltage value) every 50ns (20MHz timebase). Then I would like to write these voltage values and the corresponding time value to a text file and finally plot the voltage values over the time. The data acquisition should be started on a trigger. How can I program this application in LabVIEW 7.1.1? I use a PCI-6110 card for the data acquisition. Thanks for any help!

    I would suggest you look at the shipping examples. Open the Example Finder and from the browse tab, select Hardware Input and Output>DAQmx, Analog Measurements>Voltage. Start with one of the simpler examples such as Cont Acq&Graph Voltage-Int Clk. You can also try the DAQ Assistant. Also, saving data to a text file can be pretty slow and will be a problem trying to maintain high acquisition rates. If you acquire data for a finite amount of time, you'll probably want to save the data once it's all been acquired and not real-time. You can use any number of methods for this. The Write LabVIEW Measurements File can be used to save an array of waveforms that you've captured. There are other shipping examples for saving real-time in a binary format. There are other examples at the NI Developer Zone.

  • Measurement Probe Data Acquisition and Calculation

    Hi there,
    Can we make data acquisition from measurement probe ? I mean, can we put the data to the grapher so we can "convert" it to excel or something ? I need to show the V(dc), V(p-p), I(dc), I(p-p), etc... in the grapher view.
    Second, according to my reference, V(dc) = V(p-p)/phi or 0.318 x V(p-p) , where phi = 3,14
    This also contribute to current, I(dc) = I(p-p)/phi or 0.318 x I(p-p)
    In the calculation, MultiSim will use 0.333... or 0.32 and the result will be in quite different. So, anyone can tell me where can I get the formula which MultiSim used to calculate the circuit ?
    Ghost Recon Team Leader
    Ghost Recon Team Leader

    Hay thnx dude..
    I found the example and now it works
    once again thanks a lot

  • LABVIEW SE DATA ACQUISITION

    I need to do data acquisition from a keithley 2000 multimeter having serial port (RS 232 interface) and also IEEE 488. Does labview student edition have the necessary software ( i guess NI-VISA etc) to do so? If so, i would like to install it.

    I just purchased the NI-VISA Development Software  part #  777300-03     and NI-VISA Deployment License   part # 777300-00 . Is that all i need for data acquisition from serial device data acquisition  ?  I downloaded the driver for  Keithley 2000 meter from IDN website. So please confirm whether i am fine or anything else is needed. Your response indicates that NI-VISA alone will do the job of serial data acquisition and therefore i am not going for labview now.
    Thanks and Regards
    poli

Maybe you are looking for

  • AR - How to Combine the AR Aging Reports of 2 companies in one SQL?

    Hi! I just completed a query which mimics the Official Aged Analysis of Debtors in SAP B1 8.8, and it works well. Now I want to combine 2 companies in a single Query. Is this possible, and how can this be done? Why do I need this? I work for 2 relate

  • File name completion in Solaris 8 (SPARC)

    I am running Solaris 8 on an old SPARC-20 using the C shell. File name completion will not work for root or any other users. I have verified that all are setup with the C shell by using echo $SHELL. Other C shell features (aliases, command history, e

  • CO Activities for New Plant

    Dear Experts, I am an FI consultant and involving CO module also working for a Roll out Project. We already created a Co. Code, one Plant for New production (EOU) unit.    Now we are planning one more plant with Direct Sales activity. I want to prepa

  • To find which user has clicked on which link in capmaign mail

    When a campaign is executed we send a mail to the BPu2019s.now I have couple of link in that mail formu2026.I want to know which person has clicked on a what hyperlinku2026for e.g. I have two link one for sending to yahoo and other for my site addres

  • Runtime exceptions - Help!

    Hello, it's little ol' me again with my little ol' password generator applet. It compiles fine, but when I run it, I get all kinds of runtime exceptions when I click on any of the checkboxes. I have pored over this code til I'm blue in the face. I pe