Example Code

Start at Zero with Relative Time using Waveform Data in Charts

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • Data Acquisition (DAQ)

    Software

  • LabVIEW

    Driver

  • NI DAQmx

Code and Documents

Attachment

Overview

This example shows how to shows relative time in waveform chart.

 

Description

Within the waveform data there exists many different components, one of those components is the time stamp information.  The time stamp information can be confusing and may create results that weren't expected.  After going through this example you should have a better understanding of the time stamp data.The time stamp data is the number of seconds elaped since 12am, Friday, January 1, 1904, Universal Time.  Labview then formats these seconds into the absolute time depending upon your computer's information about time zone and daylight savings.This allows using absolute time with charts very convenient, however it is not so easy to get relative time using waveform data in charts.  In order to display the relative time in terms of when the VI was started, that moment at run-time must be known to the program.  If the difference is taken between the run-time stamp and the waveform time stamp you will get how many seconds have elapsed since the moment you ran the VI.  The image below shows what the chart would show if directly wired with waveform data and the chart that shows the timing axis that starts at zero at run-time.The t0 is time since January 1, 1904 and when viewed as relative time shows up as 900,000+ hours.  In order for the time to be zero at run-time, the econds since 1904 at the moment the run button is pressed needs to be subtracted from the t0 of the waveform data.

 

Requirements

Software

  • LabVIEW 2012 or compatible
  • NI-DAQmx 9.5.5 or compatible

Hardware

  • NI Multifunction DAQ Device

 

Steps to Implement or Execute Code

  1. Configure the parameter for the right channel and device
  2. Connect your hardware appropriately
  3. Run the VI

 

Additional Information or References

 

front_panel.png

 

搜狗截图17年01月21日2014_9.png

 **This document has been updated to meet the current required format for the NI Code Exchange.**

 

National Instruments
Applications Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
GoCougs
NI Employee (retired)
on

Done

National Instruments
Applications Engineer
GoCougs
NI Employee (retired)
on

the t0 is located within the "Build Waveform Components" that you have on your block diagram, you need to click on the orange Y and change it to t0. I have attached v8.0 of this file so that you can open it up

National Instruments
Applications Engineer
GoCougs
NI Employee (retired)
on

Thanks for your kind words, to answer your question, in order to see the absolute time (eg, 10:16AM) of the chart you only need to change the properties of the chart. If you change the properties of the chart that doesn't have the adjusted time, you will get the absolute time. Let me know if you have any other questions.

Chart.png

National Instruments
Applications Engineer
icedancer
Member
Member
on

How about multi channels?

huangxm
Member
Member
on

+1

who can tell us?

huangxm
Member
Member
on

How about multi channels?

+1

who can tell us?