LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Capturing Timestamp

For some reason I just can not wrap my head around this. I will be simply receiving a "switch" signal, either on or off ( 1 or 0 ).
I want to capture a timestamp when the signal goes on (1) and again when the signal goes off (0).
I have code created that changes the boolean from 0 to 1 but the timestamp continues to run and I want to "capture" the timestamp when the boolean changes.
I am fairly new to the programming concepts and I just know my issue is in the structure but I just can not figure it out.
 
By the way, this VI in the end, will have ultimately 10 channels turning on and off independantly based on state and will be pushed then into a database.
 
Any assistance would be appreciated.
 
0 Kudos
Message 1 of 5
(2,857 Views)
Your code with the ?1:0 function is just looking at the current state of the switch, when it is False, the output is 0 and thus the case will execute.
 
What you want to do is send the value of the switch to a shift register.  Compare the current value of the switch with the value of the previous iteration which comes out of the shift register.  When they are different, then execute the case where you capture the timestamp.
Message 2 of 5
(2,839 Views)
Raven's Fan's advice is spot on. Learn to use shift registers and you'll be able to solve 10 times (at least) as many problems in LabVIEW. They are an invaluable tool!

Here's an example that should demonstrate a lot of uses of shift registers to help you get started.
Jarrod S.
National Instruments
Message 3 of 5
(2,827 Views)
Something like this...


 

graziano


Message Edited by Graziano on 01-29-2008 01:34 AM
0 Kudos
Message 4 of 5
(2,812 Views)
Wow - I am really impressed with your replies. I wish to someday have this kind of talent.
 
I had a feeling about using Shift Registers but just have not spent a lot of time dealing with them.
I was also thinking I needed some kind of "state machine" working - just could not understand how to put everything together.
 
Both submissions work flawlessly. I like Jarrod's for his thoroughness and his complexity. And I like Graziano's for its simpleness.
 
 
Thanks guys - you were a big help for me in understanding Labview better.
 
 
Ian
0 Kudos
Message 5 of 5
(2,785 Views)