Nicholas Wittebol Posted December 8, 2006 Report Share Posted December 8, 2006 Alright, so I have a timed sequence that turns a boolean off, and then on, repeatedly, by an amount of time set by the user. I am also writing to a DAQmx device. When I monitor the line with an oscilloscope and both times set to 2ms, everything is fine. When I set them both to 0ms, it seems to stay high for about 130us, and then low for about the same, which is fine. The problem comes when I set the times to 1ms. It seems to still do 2ms. It does 2ms very accurately, even when I choose 1ms. Is there any way to get 1ms, or is 2ms the best I'm going to get? I have tried using Create Timing Source VI, and using DAQmx timing, and the results are identical. :headbang: Maybe I don't quite know what I'm doing :question: . Any help is appreciated. :worship: I have attached the test code.Download File:post-5227-1165601085.vi Thanks, Nicholas Quote Link to comment
Ton Plomp Posted December 9, 2006 Report Share Posted December 9, 2006 Nicholas, why do you mix two timing types? You have a timed sequence, which is the correct item for your application. And you use the wait function based on the OS time. I suggest you use the timing of the timed sequence (I have never used it, but think this is what you need): In the first frame, I read the start time of the frame, add the wait time and then set the start time of the next frame. You should do this for the third frame as well I think you can limit your sequence to two frames, one where you make the output high, and one where you make the output low. The timing of the frame will set the speed correct. Ton Quote Link to comment
Mike Ashe Posted December 9, 2006 Report Share Posted December 9, 2006 You are trying to set your timing to one increment of the resolution of your timing source, always a troublesome idea. You might want to try to configure to use the 1 Mhz source, if you have it available. Try setting this to 1000 (ie, 1 ms) and see what your results are. Quote Link to comment
Nicholas Wittebol Posted December 12, 2006 Author Report Share Posted December 12, 2006 I think what I've done made it worse. Now the light seems to come on for the length of time specified, and then goes off. However, after that, it never comes back on. What have I done wrong? Download File:post-5227-1165946543.vi Quote Link to comment
Nicholas Wittebol Posted December 13, 2006 Author Report Share Posted December 13, 2006 There must be someone out there who has used precise LabView timing (w/o using RealTime). I have access to timing signals from DAQmx cards if that helps. Thanks Quote Link to comment
Ton Plomp Posted December 13, 2006 Report Share Posted December 13, 2006 Hi Nicholas, what happened is that your second frame executer during a very short amount of time, so you don't see the light comming on. I added a third fram just for timing issues: Another way to get this is using a timed loop that runs at 2 ms, so the timed sequence is launched every 2 ms, but there are other ways. Ton Quote Link to comment
EJW Posted December 13, 2006 Report Share Posted December 13, 2006 There must be someone out there who has used precise LabView timing (w/o using RealTime). I have access to timing signals from DAQmx cards if that helps.Thanks Unfortunately the computer clock can't always be counted on, but i modified your vi so that it should work for you now. If it looks like it slows down or speeds up, that is just your system's ability to keep up, it may actually be running properly, but the screen updates happen too slow. but i modified your vi so that it should work for you now. By the way, i forgot to mention that i changed the clock from 1KHz to 1KHz®, which resets for every iteration. you could use a shift register and the output node to get the second frame's ending time and add that to the off time and keep looping that into the 't0", but that gets messy and it is possible for the timed loop to get farther ahead while your doing the math and then it misses. I also removed your extra local variable and have your high (T) wired directly to the terminal for the indicator. Minimize the use of variables to keep memory/processor overhead down. Hope all this helps. Good Luck!!! Download File:post-3482-1166042884.vi Quote Link to comment
Nicholas Wittebol Posted December 14, 2006 Author Report Share Posted December 14, 2006 I would like to thank you all for your help. I will add the DAQmx tasks back into this, and hook it up to an oscilloscope to see how it works now. Will post results later (hopefully I will get time this afternoon). Thanks again! Quote Link to comment
Nicholas Wittebol Posted December 14, 2006 Author Report Share Posted December 14, 2006 So I hooked 'er back up to the scope, and it seems almost perfect! I can now get timing very accurate to the ms, however, the off time always seems to be twice as long as what is entered on the front panel. This can be seen by entering 1000 for both values. When doing this, the light is on for 1 second, but off for 2. I will investigate this further, and hopefully find the problem. P.S. Dividing the Off time by 2 before putting it into the start frame does not solve the problem. So it turns out that the Off Time has to be wired directly into the Start of the next frame, and not added to the Actual Start of the sequence. Strange, as I thought since the first frame started at say 1000, that you would want the start of the next frame to be at 2000. But I guess the Start option for the right data node is relative to the previous frame. Download File:post-5227-1166123023.vi Quote Link to comment
EJW Posted December 14, 2006 Report Share Posted December 14, 2006 So I hooked 'er back up to the scope, and it seems almost perfect! I can now get timing very accurate to the ms, however, the off time always seems to be twice as long as what is entered on the front panel. This can be seen by entering 1000 for both values. When doing this, the light is on for 1 second, but off for 2.I will investigate this further, and hopefully find the problem. P.S. Dividing the Off time by 2 before putting it into the start frame does not solve the problem. So it turns out that the Off Time has to be wired directly into the Start of the next frame, and not added to the Actual Start of the sequence. Strange, as I thought since the first frame started at say 1000, that you would want the start of the next frame to be at 2000. But I guess the Start option for the right data node is relative to the previous frame. This maybe due to the timer resetting itself. try changing the off value to 0 and see if this works. if it does, you can either leave it like that, or we can go the messier route of using shift registers to carry around the current timer value. Quote Link to comment
Mellroth Posted December 15, 2006 Report Share Posted December 15, 2006 Alright, so I have a timed sequence that turns a boolean off, and then on, repeatedly, by an amount of time set by the user. I am also writing to a DAQmx device. When I monitor the line with an oscilloscope and both times set to 2ms, everything is fine. When I set them both to 0ms, it seems to stay high for about 130us, and then low for about the same, which is fine. Hi, Just a thought, if it is accurate timing on the digital line you want, why don't you use a counter output? Search the LabVIEW examples for the counter/timer examples, try one of the "Gen Dig Pulse..." VIs. /J Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.