LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time stamp for encoder data stream?

Is there a way to get an accurate timestamp to contruct a waveform when streaming encoder data?

 

John

 

Screenshot 2026-08-03 223656.png

0 Kudos
Message 1 of 2
(203 Views)

How accurate do you need the t0 timestamp to be?  Are single digits worth of millisec ok?

 

If yes, you could software query a timestamp right after starting the task.  In your posted example (that was apparently derived from one of my posted examples), you'd insert the query after starting the DO task and before entering the While loop.  I added a single frame sequence as a lazy way to enforce correct dataflow sequencing.image.png

 

 But if you want it reliably closer to 1 msec or less, you'll need to make a DAQmx input task that's hardware-synced to start simultaneously with your encoder task.  The first t0 you get back when reading from that task can be used as the initial t0 for the waveform you build with your encoder data.

 

Your encoder task is already hardware-synced to a DO task.  You could make a dummy AI or DI task that *also* borrows the DO task's sample clock in the same way as your encoder task.  Be sure to start all these borrowing tasks before starting the DO task to make sure their sampling will be hardware-synced.

 

You could read just 1 sample as a waveform from this dummy task and then stop it.  Use its waveform t0 as the initial t0 for your encoder task.  For all other iterations of the While loop, you'll need to compute a new t0 for the next incremental chunk of data based on the initial t0 + (dt * (total # samples so far)).

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 2 of 2
(134 Views)