DAQ AO to AI time delay

Hallo,
I'm working on an academic control project, where I need to read (ni9215) 3 or 4 channels very fast,
process the data and write them back (ni 9263) via usb-chassis 9172. To check the accuracy and time
delays I tried a loop from AO to AI (only one channel) and generated a step, saved the timestamp of the
step and checked, when the step was readed in the written measurement log. I doesn't see andy difference
in using two VI's to read and to write or combining them in one VI, so I added images of two VI's.
While comparing the timestamps of the sampled step and the log file, i noticed time delays of about 200ms
from output to input. So my VI's are times too slow for my control purpose... anybody knows, what to try?
In this VI I read data with 500hz, 10 samples to read and 10 samples/channel. The read timeout is set to
default, but if I set it to zero, strange (negative) times are written to the measurement log... I tried
to change from N samples acquisition to single sample acq, but it didn't speed up the VI.
Thanks for answering!

Hi IoInNBlack,
first of all thank you for posting in this forum.
I think you should synchronize your input/output operation, otherwise I don´t understand how you can take the timestamps and consider them
reliable for your evaluation. I suggest you to modify the LV example here attached with timestamps and file I/O to build up your test and see what results you get then. Consider also that  20 ms are necessary for the acquisition of the samples and then you have add the time necessary to manage the file I/O.
Best regards.
Andrea P.
Message Edited by pxchellone on 07-06-2009 09:23 AM
Attachments:
Multi-Function-Synch AI-AO.vi ‏35 KB

Similar Messages

  • Urgent: Please help. how to solve the time delay during buffer read and write using vc++

    I need to continuously acquire data from daqmx card, write into a file and at the same time corelate (in terms of time) the data with signals from other instruments. The current problem is that there is time delay during read and write data into buffer,thus causing misalignment of the data from multiple instruments. Is there a way to solve  the delay? or Is there a way to mark the time of the data acquisition in the buffer?  If I know the starting time (e.g. 0) of data acquisition and sampling rate (e.g. 1kHz), can I simply add 1ms to each data sample in the buffer? The current code is shown below.
    void DataCollectionWin::ConnectDAQ()
    DAQmxErrChk(DAQmxCreateTask ("", &taskHandle));
        DAQmxErrChk(DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai0,Dev1/ai1,Dev1/ai2,Dev1/ai3,Dev1/ai4,Dev1/ai5,Dev1/ai16,Dev1/ai17,Dev1/ai18,Dev1/ai19,Dev1/ai20,Dev1/ai21,Dev1/ai6,Dev1/ai7,Dev1/ai22","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,NULL));
      DAQmxErrChk(DAQmxCfgSampClkTiming(taskHandle,"",1000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,60000));
      DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent(taskHandle,DAQmx_Val_Acquired_Into_Buffer,50,0,EveryNCallback,NULL));// Every 50 samples the EveryNSamplesEvent will be trigured, to reduce time delay.
      DAQmxErrChk (DAQmxRegisterDoneEvent(taskHandle,0,DoneCallback,NULL));
      DAQmxErrChk (DAQmxStartTask(taskHandle));
    int32 CVICALLBACK EveryNCallback(TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData)
     DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,50,10.0,DAQmx_Val_GroupByScanNumber,data,50*15,&read,NULL));
       //memcpy(l_data,data,6000);
      SetEvent(hEvent);
    l_usstatus_e[0]=g_usstatus[0];// signals from other instruments that need to be corelated with the data from daq cards.
     l_optstatus_e[0]=g_optstatus[0];
     if( read>0 ) // write data into file
       //indicator=1;
     for (i=0;i<read;i++)
     {  //fprintf(datafile,"%d\t",i);
      fprintf(datafile,"%c\t",l_usstatus_s[0]);
      fprintf(datafile,"%c\t",l_usstatus_e[0]);
            fprintf(datafile,"%c\t",l_optstatus_s[0]);
      fprintf(datafile,"%c\t",l_optstatus_e[0]);
              fprintf(datafile,"%.2f\t",data[15*i]);
     //   sprintf( pszTemp, "%f", data[6*i]);
     // pListCtrl->SetItemText(0, 2, pszTemp);
        //pWnd->m_trackinglist.SetItemText(0, 2, pszTemp);
         fprintf(datafile,"%.2f\t",data[15*i+1]);
         fprintf(datafile,"%.2f\t",data[15*i+2]);

    Hello kgy,
    It is a bit of a judgment call. You should just choose the board that you think has the most to do with your issue. For example, this issue was much more focused on setting up your data acquisition task than the Measurement Studio environment/tools, so the MultifunctionDAQ board would have been the best place for it. As for moving your post to another board, I do not believe that is possible.
    Regards,
    Dan King

  • Time Delay to wait for a solenoid to open

    I have a Shutter that opens fine but I need to wait with some Time Delay before I continue to process some information.
    I am using Labview 7.0 and have a DaqPad-6016.

    It would be helpful to see your code to see exactly what you are doing.
    However, LabVIEW does have several options for waiting. I have attached a screenshot showing some of these. The time delay is especially useful with DAQ because you can wire your task's error wire through the wait. This will cause the delay to explicitly happen in between the execution of VIs.
    -Sal
    Attachments:
    wait.JPG ‏42 KB

  • Generate two sine waves with time delay

    I have not been using the waveform generation tools so I hope this is an easy one for somebody.  I want to create two sine waves at different frequencies say F1 = 1.00 KHz and a second at F2 = 1.20 KHz.  I know that to combine them into one I can just add them.  Them problem I have is that I want F1 to start first then a few millisecond later have F2 sum into F1.
    T0 = F1
    T0 + Delay = F1 + F2
    Is there a VI capable of a time delay?  Tried to sum individual signals together but seems more difficult because of the waveform cluster format.
    Any help is appreciated,
    Matt
    Matthew Fitzsimons
    Certified LabVIEW Architect
    LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison

    Would the attached VI work for you?
    Attachments:
    Add Delayed Sinewave.vi ‏54 KB

  • Time delay between 2 waveforms

    Hi,
    Please bear with me while I explain what I’m trying to do :-)   Basically, in the attached LabView file (“flow vis + trigger-m.vi”), I am generating 2 signals: a sinusoidal waveform (used to drive an actuator) and a square waveform (used as a TTL signal to trigger image capture on a CCD camera). Currently when I run the program using LabView 7, both signals are started simultaneously. I would like to introduce a time delay that can be manually specified in the VI, such that when the program is started (i.e. at time t0), the sinusoidal waveform also starts (i.e. at time t0) before the square waveform (i.e. at time t0 + delay time). In a practical sense, this means allowing the actuator to run for several seconds before capturing any images.
    It sounds like it should be quite straightforward to do, but I’m not so sure how to progress. I have begun to modify the original VI (“flow vis + trigger-m_2.vi”, as attached), but would be much appreciative of any help or suggestions on how I can complete the VI to meet the above requirement.
    Many thanks,
    Mark
    Attachments:
    flow vis + trigger-m.vi ‏939 KB
    flow vis + trigger-m_2.vi ‏895 KB

    Please refer this URL for an example VI I made to solve the problem:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=227603
    Way S.
     NI-UK Applications Engineer

  • Creating a Time Delay Between 2 Waveforms

    Hi,
    Please bear with me while I explain what I’m trying to do :-)   Basically, in the attached LabView file (“flow vis + trigger-m.vi”), I am generating 2 signals: a sinusoidal waveform (used to drive an actuator) and a square waveform (used as a TTL signal to trigger image capture on a CCD camera). Currently when I run the program using LabView 7, both signals are started simultaneously. I would like to introduce a time delay that can be manually specified in the VI, such that when the program is started (i.e. at time t0), the sinusoidal waveform also starts (i.e. at time t0) before the square waveform (i.e. at time t0 + delay time). In a practical sense, this means allowing the actuator to run for several seconds before capturing any images.
    It sounds like it should be quite straightforward to do, but I’m not so sure how to progress. I have begun to modify the original VI (“flow vis + trigger-m_2.vi”, as attached), but would be much appreciative of any help or suggestions on how I can complete the VI to meet the above requirement.
    Many thanks,
    Mark
    Attachments:
    flow vis + trigger-m.vi ‏939 KB
    flow vis + trigger-m_2.vi ‏895 KB

    Hi Mark,
    I forgot that all analog waveforms generated needed to have the same number of samples in a single task. By introducing a delay into your square wave, I effectively added samples that waveform. So the same number of samples added to the square wave has to be added to your sine wave. I added code that extends the number of samples of your sine wave (# delay + square wave samples). Let me know if this works for you.
    Regards
    Way S.
    NI UK Applications Engineer
    Attachments:
    flow vis + trigger-m70.vi ‏872 KB

  • My recirculating pump in sub vi simulation link doesnt work in the second iteration .It opens for maybe half a second whereas i gave the time delay for 5 secs..plz help very urgent

    Hi,
         I have attached my simulation loop.In the model attached i hav eone main pump with constant rpm which drives the 5 smaller pumps and fills the tank at the same time.As soon as the tanks reach their 90% level,the valves of the five pumps close(SP1,SP2,SP3,Sp4,Sp5).After that the recirculating pumps opens for 5 secs of the first tank.As soon as the recirculation finishes,the drain valve(SV1) for tank 1 open and the volume goes to interim storage.This happens for all the remaining tanks.
    My simulation works the first time,but when the second time the loop starts,it skips the recirculation pump even though i gave a time delay for 5 secs.Plz help ..I have attached the simulation.
    Thanks,
    Rami
    Attachments:
    Spatial Logic_2_Final.vi ‏223 KB

    Rami,
    I suspect that you have a race condition. The widespread use of local variables frequently leads to race conditions. Your subVI (Spatial Logic Sub_2.vi was not included) so I cannot run the VI. You have no way of knowing whether the subVI or the inner case structure will execute first, because there is no data dependency between them.
    I think a shift register or a few and some dataflow thinking would allow you to eliminate the inner case structure, the local variables, and, probably, most of your problems.
    Some of the SPi are indicators and some are controls. How are they used?
    The last case of the inner loop retursn to Case 1. Would case 0 be better?
    As for the second time through issue, it may be related to the Elapsed time function Auto Reset. From the help file: "Resets the start time to the value in Present (s) when the Express VI reaches the Time Target (s)." If more than 5 seconds elapses between the first time you use this and the next, it will exit immediately on the subsequent calls.
    Lynn

  • How can I put a time delay between specific events in a while loop?

    How can I put a time delay between specific events within the same while loop? I'm already using the "wait" command to control the overall loop iteration speed. But I want to time the individual events as well.

    Hi Jesse,
    You can use a flat sequence. In each box you can put your individual events and attached wait.
    Don't forget to reduce your total loop time of the time you added in the individual sequences.
    Doc-Doc
    Doc-Doc
    http://www.machinevision.ch
    http://visionindustrielle.ch
    Please take time to rate this answer

  • Time Delay Express VI default to show as icon?

    I am really only intrested in the Time Delay "express vi"
    This is the only express vi I ever use and it drives me nuts everytime I drop it in and this HUGE box takes up space for nothing.
    I would really love to have just the one VI able to default to Show as icon.
    Attachments:
    Time.png ‏32 KB

    Part of me says that Express VIs should be as annoying as possible so they go away.  But, in the spirit of trying to be helpful I will offer one suggestion.  I have created a subVI which only contains the time delay Express VI.  You can add this to the Palette (ie. user.lib) and go to Tools->Advanced->Edit Palette Set find the SubVI, right-click and select Place VI contents.  Now when you choose this version it will drop in as an icon.
    Attachments:
    TimeDelay.vi ‏19 KB

  • I've tried every online tutorial for timer.delay + experimented... how to make it work in this sitch

    Hey,
    I've read literally every single timer.delay tutorial I could find online, on youtube, the official documentation, tons of posts on this forum, etc. What I am trying to say is I looked everywhere before posting for help.
    I have a timer running. It runs throughout the game. I need to modify the speed of that timer when a player either hits a certain second(won't work, because the timer is already running) or when someone gets a certain score(can't get it to work, because timer is running).... so my question is how do I get timer.delay to work when the timer is running throughout the entire game. I tried to control the delay by when someone gets a point, but that didn't work either. I am using a trace statement so I see the seconds and the timer speed. the code looks something like
    randomvariable = new Timer(2000,8);
    timer.addEventListener(MouseEvent.CLICK, loop);
    timer.start();
    function loop
    // my looping code here
    What I posted is psuedo code.
    Any ideas on how to make the timer go faster without delay, since I can't get delay to work under the circumstances I explained? Or is there a work around that I don't know about? I will try to give back to the forums by answering other questions. Oh, I am running this on the timeline, not in a .as file. Thanks so much for your help!

    That's what I thought. I thought if I set a delay inside the function or in an if statement for the var that  prints out  the timer decrease that it would work. It doesn't. I'm using Adobe AIR for IOS, but I doubt that makes a difference in this case. I write timer.delay=500; that should make the timer go at 500 milliseconds. My trace shows the amount of milliseconds didn't change throughout the application. It is quite bothersome, since everything else works and every guide and the docs say what I am doing should work. Any ideas?
    Thanks.
    Sincerely,
    Ryan Satterfield

  • How to add a time delay of microsecond in labview 2011

    can you please help me, how to add a time delay of microseconds in labview 2011 version . I expect a helpful replies

    A delay between what and what?
    Is this plain LabVIEW, LabVIEW RT, or LabVIEW FPGA? What kind of data acquisition hardware are you using?
    What is your OS? An accurate "software only" delay of microsseconds is not possible on windows or any other general purpose OS.
    perumpadapu wrote:
    ... I expect a helpful replies
    To get a helpful reply, you need to provide much more detail on what you are trying to do!
    LabVIEW Champion . Do more with less code and in less time .

  • Crosscorrelation time delay question

    Hi!
    I have a project, where i work with 2 microphones, and i want to calculate the time delay between the two signals. I had made a simple method for it, but it's a bit bad...
    So now i  try it with crosscorrelation, but i can't get a correct time-format...i had made the correlation correct, i have just some problem with the time format...
    If i convert the time format into string with %<digit>, then i always becom 0...
    Here is my vi, can somebody help me?
    Attachments:
    CrossCorrforum.vi ‏134 KB

    I took a peek- your problem is with the format string on the timestamp to string functions.  Your format strings are "%5u" and "%S"  the %5u returns a string that represents 5 digits of fractional seconds, the %S converts only the whole number of seconds
    FROM the help-
    for format timestamp to string
    ..." Time
    format codes include the following:
    %a (abbreviated
    weekday name),
    %b (abbreviated month name),
    %c (locale-specific date/time),
    %d (day of month),
    %H (hour,
    24-hour clock),
    %I (hour, 12-hour clock),
    %m (month number),
    %M
    (minute),
    %p (a.m./p.m. flag),
    %S (second), %x
    (locale-specific date),
    %X (locale-specific time),
    %y (year within century),
    %Y (year including century),
    %<digit>u (fractional seconds with <digit> precision).
    So, How do you want to display the time information?  If you want 1 January 1900 12:00:00.000AM to display as "1/1/1900 12:00:00.0am" your format string should be "%d/%m/%Y\s%I:%M:%S%1u\s%p"  (ESCAPE CODES DISPLAYED)
    Jeff

  • Time delay separate to while loop

    How would I be able to obtain data (pressure read in by DAQmx) that happened 2 seconds previous?
    I need to obtain the pressure difference from 2 seconds ago hence need the previous pressure with a 2 second time delay. When I try and do this the whole program delays by 2 seconds, even when I try separate the time delay through use of another time loop. 
    Any suggestions?

  • Use the LabView time delay in a while loop instead of using the instrument inherent time loop.

    I have a zes lmg500 that I use. It has the option of continues measuring data, with a user control cycle loop (still using a while loop but the delay is coming from the instrument). The problem is that the loop time is not constant. Can I use a very short time (100ms) as the instrument cycle time but use a longer time delay in the while loop that collect the data?
    I know many instrument offer the same abilities, so the question is relevant to all of them.
    Thanks for any help
    Solved!
    Go to Solution.

    Does that measurement VI have built-in wait functionality and a timeout?
    If not, then you are simply polling the VI at 1 kHz, but I suspect that this is not the case or your Waveform Chart probably wouldn't look as you expect (getting 0's put in everytime measurement data is not available).
    I expect that if you have the instrument set up to send data at a fixed time interval (i.e. 100 ms), all the data that it is sending you will end up residing in your serial buffer (or the instrument driver will have taken it out and put it in another internal buffer), so if you come back to read it 1 sec later, then you will have 10 data points to go through.  Whether you can read them all at once with the read VI or have to call it a whole bunch of times until empty I can't say.
    What is your objective?

  • How to include Time delay in GUI enviroment

    hi all,
    i want to include time delay while drawing the shapes in the Canvas. I tried with Thread.sleep() and also delaying methods by making them to loop for large number of times.... but it affects the repainting of my Frame window like just previously executed snippet of the code gets repeated again and the delay between the shapes drawn cannot be visually seen..
    Can anyone help me????

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class DrawingExample extends JPanel implements ActionListener {
        private Timer timer = new Timer(200, this);
        private Rectangle[] rects = new Rectangle[10];
        private int currentUB;
        private boolean desc;
        public DrawingExample() {
            for(int i=0; i<rects.length; ++i)
                rects[i] = new Rectangle(i*15, i*15, 40, 40);
            timer.start();
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D) g;
            for(int i=0; i<currentUB; ++i)
                g2.draw(rects);
    public static void main(String[] args) {
    EventQueue.invokeLater(buildApp);
    public void actionPerformed(ActionEvent evt) {
    currentUB += desc ? -1 : +1;
    if (currentUB == -1) {
    desc = false;
    currentUB = 1;
    } else if (currentUB == rects.length+1) {
    desc = true;
    currentUB = rects.length-1;
    repaint();
    static Runnable buildApp = new Runnable() {
    public void run() {
    JComponent comp = new DrawingExample();
    comp.setPreferredSize(new Dimension(300,300));
    JFrame f = new JFrame();
    f.getContentPane().add(comp);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.pack();
    f.setLocationRelativeTo(null);
    f.setVisible(true);

Maybe you are looking for