LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

extract millisecond timer value from sub vi

Dear All,

I have a sub VI, that is incuded into a main program. The sub VI reads an analog voltage signal, which is then sent to the main application. I would like to generate a time value (with a millisecond timer) at the moment when the pulse arrives, so that later in the main program I can decide if the signal arrived inside of a certain measurement window, or not. However, I do not know how to transfere the time value to the main application...
I would appreciate any advice...

 I can generate the time stamp in the main program, but the time delay, compared to the true arrival time of the pulse, is quite significant...

Thank You,
Regards,
oistvan
0 Kudos
Message 1 of 4
(2,636 Views)
The thing to remember is that the output of the millisecond timer is not a timestamp. It is simply the value of a counter that starts when LV is launched and increments every millisecond. This has two implications:
  1. The output of the millisecond timer bears no inherent relationship to the output of the VIs that generate timestamps.
  2. Because it is only a 32-bit counter it will rollover about every 42 days as I recall - you can do the math...
Something you might want to look into is performing this timing using a hardware counter on the DAQ card.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 4
(2,632 Views)
Dear Mike,

I appologize for probebly mixing up timestamp and milisecond timer value...
I´ll try to describe the problem better.
  In the main program I start a milisecond counter. Following this I have a while loop, which runs untill the difference between another milisecond counter running in the loop and the first counter becomes larger than a set value. The set value in our case is the length of the measurement window.

The above while loop contains a sub vi, which reads (samples) the analog voltage from an acquisition card, and returns the sampled values in an array. (The sampling is triggered, when the voltage at the acquisition card exceeds a certain value.) 

The inreresting information except the height of the signal is the time when the signal arrives, with respect to the start of the while loop in the main program. So I thought I just read a value in the sub vi, when the signal arrives. Then, by comparing the time values, it can be decided, if the signal came inside the measurement window (and it schould be written to a file), or it should be neglected.

ofcourse, I am open to any other suggestions, regarding how to solve the problem...

thanks
  oistvan

Message Edited by oistvan on 06-09-2007 11:44 AM

0 Kudos
Message 3 of 4
(2,628 Views)
Ok, I think I understand what you are trying to do a bit better. However, using the millisecond timer in this way is still dangerous due to the rollover issue. Because this counter start when LV boots up the roll over occurs every 42 days from when LV started - not from when your VI started.

It occurs to me also that you essentially have timing data within the data you are acquiring. If you know the time that the acquisition started and the sample rate, the index of any datapoint times the reciprocal of the sample rate will tell you how long after the start of acquisition that the point occurred. Likewise, if the acquisition itself is triggered, this calculated value is the time between the trigger and that point - give or take a few nsec.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 4
(2,611 Views)