LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timer doesn't work

Hi, I am writing a vi which involved a timer"minisec multiple".  However the VI almost never waits for the the number of second it suppose to.  Can't figure out why. 😞 I am using labview 7.1 on XP)
 
the attatched is the vi
Can a computer learn how to program?
0 Kudos
Message 1 of 7
(3,440 Views)
Your VI couldn't be run since it depended on a bunch of other stuff that you didn't include. However, I think the simple answer to your question based on your statement "the VI almost never waits for the the number of second it suppose to" is that you need to use the "Wait (ms)" function to wait a specific amount of time, which in your case is 1 second, instead of the "Wait Unitl Next ms Multiple".
Message 2 of 7
(3,425 Views)
The Wait Until Next ms Multiple does not wait for the specified time, it waits until the timer is a multiple of the specified time.  The VI you want is Wait (ms).  This vi waits the specified number of milliseconds.

For example:
When you enter the second frame of the flat sequence structure, assume that the timer is at 4986ms.  Wait Until Next ms Multiple will wait until the timer reaches 5000 ms (the next multiple of 1000 ms) and you will enter the 3rd frame after 14ms.  Wait (ms) will wait 1000ms and you will enter the 3rd frame when the timer reaches 5986ms.


----
I am the founder of CnCSoftwareSolutions. When not cleaning up baby drool, I write about test data or work on Vision, a tool for understanding your test data. Visit me at www.cncsoftwaresolutions.com
Message 3 of 7
(3,424 Views)
Do you mean the wait in the second frame of the flat sequence structure or the waits in the stacked one? If it's the ones in the stacked sequence and you expect to have a certain delay either before or after the other code in the same same frame, you don't understand the basics of LabVIEW. Because there is no dataflow between the wait and the other code, you have no way of knowing which will execute first. It is liable to change every time the VI is re-compiled. You can use the Delay function which has error in/error out connections that you can use to control dataflow or add additional frames with just the wait in it. You might also want to get rid of the Write to Digital Lines functions for the same reason. They have no error in/error connections and correct error handling is important for reason other than dataflow. Use the Port Config and Port Write functions that are inside Write to Digital Line or use DAQmx since you've got LabVIEW 7.1
0 Kudos
Message 4 of 7
(3,424 Views)
Kevin,
You are using the "Wait until multiple" vi. Since you have wired 1000
to the input, your program will wait until the internal millisec
counter reaches a multiple of 1000. So if you the counter was at 47820
when you entered the "Wait until multiple" vi, it would wait until the
counter was at 48000, a delay of only 180 milliseconds. Use the "wait"
vi instead (looks like a wristwatch).
TJ



On Mon, 23 Jan 2006 17:13:04 -0600 (CST), kevinhy <x@no.email> wrote:

>Hi, I am writing a vi which involved a timer"minisec multiple".&nbsp; However the VI almost never waits for the the number of second it suppose to.&nbsp; Can't figure out why. 😞 I am using labview 7.1 on XP)
>&nbsp;
>the attatched is the vi
>
>
>XMDV1.vi:
>http://forums.ni.com/attachments/ni/170/162872/1/XMDV1.vi

Message 5 of 7
(3,406 Views)
Thanks to you all, with the clear explanations, the problem is solved.  Now the VI runs as it is designed to.  I have to admitt that I don't know the basics of Labview, in fact I am just a baby still learning walking in the programming work; but I am working hard and trying to solve all the problems I must solve no matter how difficult they are.  That is why I am seeking all the helps I can possiblely find.  If my ignorance or my way of doing thing would offend someone, I apology; but none will change my determination to learn and to solve all the problems.
 
thanks again.
Smiley Wink
kevin
Can a computer learn how to program?
0 Kudos
Message 6 of 7
(3,385 Views)
Keep at it Kevin!  I don't think you're offending anyone here.  It's a very helpful community.  Good luck!
----
I am the founder of CnCSoftwareSolutions. When not cleaning up baby drool, I write about test data or work on Vision, a tool for understanding your test data. Visit me at www.cncsoftwaresolutions.com
0 Kudos
Message 7 of 7
(3,377 Views)