LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

last value from timer

Solved!
Go to solution

Hello,

 

I have some problems storing timer values and appreciate all help i can get.

 

Program backround: Will be used to collect data (time, count) interval between packets on an asembly.

 

Needs to: Count number of packages , and to show time between the packages.

 

My issue is that when i save to spreadsheet each incriment of time stuck on/off is being saved. This could lead to a large number of unnecessary data points. Instead I want only the last non zero value of the stuck on/off timer saved. 

 

Any help is greatly appreciated.

 

~Modi

0 Kudos
Message 1 of 15
(3,390 Views)

Hi,

 

Assuming I understood your code correctly, you need to add an if to your voltage change event (see attached -  False case just connects the error wire and has nothing else). As it is now, you are timestamping every iteration of the while loop in "Measure" event, whether voltage changed or not. Value (Signal) activates the event whether the input is true or false.

 

I have to admit I'm not sure I understood your code, as I see no way for the while loop in "measure" to end. How do you stop the VI? I can't run it as I don't have the hardware.

 

Hope this helps,

Danielle

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 2 of 15
(3,373 Views)

Thx for fasr respons.

 

code is far from finished.
the problem I have is that after every package that is recorded as the time between packets will show 1234 ....... 89 90 91, I only need to know 91 How do I remove all the other times being recorded?

 

Excuse my poor explanation and bad knowledge in LabVIEW. This is my first big prosjekt.

0 Kudos
Message 3 of 15
(3,362 Views)

Hi,

 

Did you try adding the if loop as I said before? Alternatively you can use the value(signal) property node only if global value changed is TRUE. Do one of these solutions solve your problem?

 

Danielle

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 4 of 15
(3,355 Views)

Hello,

 

I did as you said and it didnt change anything, it's stil regsitring all the seconds between the boxes. Everything is working the right way exept for the time registration, first box is 1 2 3 4 . . . 12 13 14, then a reset , 2 box is 1 2 3 4 5 .. . . . 10 11 and so on. I read about the The boolean crossing PtByPt VI but didnt understan everthing there, it was writen that i could cansel out every digit exept for the last one from the timer

 

 

 

 

Modi

0 Kudos
Message 5 of 15
(3,348 Views)

hi,

 

Have you tried saving the current time in Arduino Measure? Every time voltage change = true write current time to a spreadsheet file? You can use excel afterwards to get the difference. 

Or you can save the current time to labview variable, but be careful of race conditions!

Or you can use two timestamp references that would be input the measure VI: current and previous. Every time voltage changed = true, set previous value = current value and current value = NOW. subtract them to get the value you want and save it to a file from there.

Also, using the global voltage change boolean is asking for trouble in the form of race conditions. Use the reference to the voltage change boolean on the front panel of main for everything, and make sure that only measure writes and all the rest read.

I'm still not sure I understood your code, so my apologies if I missed something obvious. 

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 6 of 15
(3,329 Views)

hi,

 

Thanks for trying and it's my fault for bad explanation.

 

I will try to explain the whole thing,

The Arduino is a sensor that identify if there is a packeage on the asemblyline, to be aboule to use this signal i hade to use global (voltage change=call it volt). the volt starts up the timerand will reset the timer each time ther is a package there. the information from the timer will be sendt to be filed, the problem is that i just need the last digit from the count and not all data, like in the file i have attached.

i dont know how to make the two timestamp references that would be input the measure VI, 

 

I have to apologies for the bad coding and bad understanding. 

 

Modi

0 Kudos
Message 7 of 15
(3,311 Views)

forgot to attache the file 😛

0 Kudos
Message 8 of 15
(3,310 Views)

Modi, please don't apologize! Otherwise I would have to apologize too 🙂

 

Thanks for your file, I think I got it now. Use the booleanptbypt vi on the voltage change to trigger the timestamp instead of triggering the timestamp whenever volt is true. See attached VI, third loop, Measure state. 

 

I hope this solves the problem.

 

Danielle

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
Message 9 of 15
(3,293 Views)

hi Danielle.

 

this was exactly what i was looking for, but it did not work in the program. I tried a different approach. I tried to put it right into timer.vi (did not work either ) but I'm not sure what I've done wrong? il add the timer.vi here.

0 Kudos
Message 10 of 15
(3,275 Views)