LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timer problem

Finally I chose to make it in this format...
 
I was just curious though, how would we write out a loop if we wanted to know the time that passes between each "press of the button".
Meaning, somethign that would display " 20 seconds" has elapsed since you last took a recording
Aquaphire

---USING LABVIEW 6.1---
0 Kudos
Message 11 of 26
(1,368 Views)
Use a shift register and a case structure. On the first call or when the button is pressed, set the shift register to the current value of the tick counter. Any other time the elapsed time is the now current tick value minus the value stored in the shift register. If your computer is on continuously for weeks, remember that the tick count rolls over to zero about evry 49 days.

Lynn
0 Kudos
Message 12 of 26
(1,362 Views)

Of course, there is a slight code flaw that there is a nonzero chance (1 in 4294967296 ;)) that the timer output is naturally zero, in thise case it would reset again, breaking  the desired functionality.

To make it totally waterproof, you should modify it as shown for example in this attachment.

Message Edited by altenbach on 07-05-2005 12:56 PM

0 Kudos
Message 13 of 26
(1,363 Views)
I don't understand... your loop works, mine won't. It shows this wierd super big digit... but apparently its identical... what did I do wrong?
 
Oh, and Lynn, I still havent managed to do what u suggested using a case structure/shift register. I don't understand how to "store" the information? Do I create an array inside the case structure? thanks.

Message Edited by Aquaphire on 07-05-2005 03:17 PM

Aquaphire

---USING LABVIEW 6.1---
0 Kudos
Message 14 of 26
(1,351 Views)
You need to wire the two shift registers across in the FALSE case of the big case structure. Right now your shift registers reset to zero whenever the false case executes.
0 Kudos
Message 15 of 26
(1,346 Views)
Ok i managed to fix that part alternbac. Thanks 😉
Aquaphire

---USING LABVIEW 6.1---
0 Kudos
Message 16 of 26
(1,338 Views)
Hehe guys. Thanks a lot I managed to make my "time between each experiment" part 🙂
 
theres a slight off-set though for  " ??? " reasons, its not very important, but if anyone can find out... thanks!
 
Aquaphire

---USING LABVIEW 6.1---
0 Kudos
Message 17 of 26
(1,331 Views)

Don't overdo it! 🙂

Why do you think you need to duplicate all that code at the bottom? (One little case structure does everything you possibly need for this.) Then you take the value in seconds and display it as a U32 and call it "millisecond timer value"? This makes little sense. You also have two boolean shift registers that always carry the same value. This is redundant.

U32 is unsigned integer, so you loose all decimal places. IF you want to show the raw millisecond timer value, just tap into it before you divide by 1000 to get the seconds. Right? 😉

Maybe I don't quite understand what you are trying to do.

0 Kudos
Message 18 of 26
(1,329 Views)
Hey Altenbach,
 
Actually, my code did not work as planned. I was in a hurry to get home and didn't realise that I didn't find what I wanted.
 
What I'm trying to do is find the DIFFERENCE of time between each loop that was ran.
 
Example:
 
 
TIME:            Total Elapsed Time:        Time Between expermiments:
10:23:23                  0                                          0
10:23:27                  4                                          4
10:23:29                  6                                          2
10:23:34                  11                                        5
 
 
That would explain why I was tryign to play with 2 shift registers... 🙂
 
Aquaphire

---USING LABVIEW 6.1---
0 Kudos
Message 19 of 26
(1,314 Views)
PS> I still havent managed to fix the problem... so if anyone can help... 😉 thanks, much appreciated.
Aquaphire

---USING LABVIEW 6.1---
0 Kudos
Message 20 of 26
(1,304 Views)