Unwanted time delay

    I am trying to control the motion of a stepper motor using LabView 8.0.  I have had success controlling it with the terminal that comes with the motor, however I would like to have an end-user friendly interface.  I have written a vi that works fine, with the exception of one problem.  When I command the motor to make a move, there is a delay of about 10 seconds before the motor actually moves.  Attached to the boolean control is an indicator light which remains on after I click the button, and it stays on for about 10 seconds before the motor makes its scheduled move.  I am using stacked sequence loops with five frames (one for acceleration, velocity, position, deceleration, and the command to begin the move).  I do not believe it is a CPU issue, since the terminal is able to control the motor with instantaneous results.  Does anybody have any suggestions as to how to eliminate this time delay? Thanks in advance for any help.
Tom

Tom,
After looking over the code for a bit, I noticed that there
are several ActiveX methods that get called every time the while loop iterates,
regardless of the functionality needed.  The
following commands are sent every time the while loop iterates:
TDX
PF 7
ST
SH
The other commands are not called every time the loop
iterates because of the case structures. 
They are called only when needed. 
ActiveX is by nature slow.  You
are communicating between programs and then communicating from one program to
an external device.  Conceivably, all
four of those commands could have to execute after the button is pressed to
move the motor and before the movement code begins.  Try manipulating your code so that ActiveX
methods are called at a minimum.
Also, for curiosity’s sake, what is your setup here?  I haven’t encountered someone doing motion
control in LabVIEW through ActiveX before.  What hardware are you talking to?  What are you communicating with through
ActiveX?
Thanks,
Luke H

Similar Messages

  • 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

  • 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

  • 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);

  • PSE 7+ Sudden Animation Time Delay problem?

    I've been using Photoshop Elements 7+ for a long time now. And I've been able to make animations with it. Such as can bee seen on this url: http://i47.tinypic.com/35iumww.gif I know how to change the Time/Frame delay settings quite fine. But as of today my time delay hasn't been working. This is quite random considering I haven't done any kind of updating or editing to the program in general. When trying to set the time delay to 0.15 and clicking the preview button, I find that my animation is as at the default number's speed, 2. Upon changing the time delay many different times, from 0 to 10 (the min and the max), the animation's speed still doesn't change.  I'm at the end of my rope with this and none of my PSE educationed associates know what could possibly be wrong. I did download two fonts today, but that's it. So unless someone might be able to figure out what's changed, then I might have to try and re-install the program. Something I don't want to do. I have a visual if that's of any help.
    http://i47.tinypic.com/e9w64k.png
    Also, I am using a Mac.

    Which version are you using now? You can't be using PSE 7 on a mac, because there is no PSE 7 for mac. The frame delay problem exists in the mac versions 6 through 10. You can either upgrade to PSE 11 or use a program like the free giffun from stone.com to assemble the gif and set the frame rate.

  • Using more than one time delay in a thread

    Hello,
         I need to use two non-consecutive time delays in a thread. My thread typically proceeds as follows:
    1. Tell an oriel MS257 to change wavelengths
    2. Time delay #1 to give the MS257 time to change
    3. Tell HP 4156C to start sweeping
    4. Poll the 4156C until sweeping is complete
    5. Time delay #2 to give 4156C time to load data
    6. Read/parse/save data
    My problem is that the second time delay seems to start counting immediately after the first one - it does not wait for the sweeping to complete before counting. My VI is attached. It's a bit messy - organizational tips are also welcome!
    Thanks,
    Ying 
    Solved!
    Go to Solution.
    Attachments:
    TFTmeasure.vi ‏115 KB

    Looking into the sources show: Cleanup is a nice tool (even thought it is far from perfect )
    Well, nevertheless, from the wireworking, it seems alright that the second Time Delay express VI should indeed wait for the loop to finish. Therefore, i am wondering why it is skipped. And the only reasonable explanation: You have an error on the error cluster.
    So please debug into it using highlight/probes on the error cluster to make sure that you are not running into issues here.
    hope this helps,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

Maybe you are looking for

  • How to Add points on graph from a text File ?

    Hello and Good Morning to all, I have a text file with my data and i read them by using the Read From Spreadsheet File VI,i enter the path where my file is saved,read all rows delete the first row because i don't need it and my problem is that in the

  • Default value in MIGO transaction for PLANT specific

    Hi Experts, I am looking for default vaule in MIGO transaction. Whenever goods receipt is entered for one particular PLANT ,i want vaule to be dafaulted in Quantity tab No.of container unit value to be PC for english and ST for german. Is is possible

  • Cannot connect to imaging server after ZDML SP1 IR3 install

    OK, here's a bit of an odd problem... well, actually, I hope it's an insanely easy problem that I just have overlooked a simple solution for. I guess that's for you guys to help figure out. ;) We had been running Zenworks 7.0.1.0 on an OES1 Linux ser

  • Cant download from app store on device?

    I get this error: AppName will be available for download when you log in to the iTunes Store on your computer. How to fix?

  • Fitting 2D- and 3D-geometries

    I have a set of 3D-coordinates representing points in 3D-space. This set of points represents a relatively simple 2D or 3D geometrical element like a circle, a rectangle, a sphere, a cylinder, a plane, a cone, ... and I know the type of geometry that