Example Code

FPGA Timekeeper to Timestamp in LabVIEW

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

  • CompactRIO|SingleBoardRIO

    Software

  • LabVIEW FPGA Module
  • LabVIEW

Code and Documents

Attachment

Overview

This example shows how you can take the output from the FPGA Timekeeper timestamp, and calculate the date and time. 

 

Description

The FPGA Timekeeper is very precise, but its native timekeeping data structure (ns since the TAI epoch) is hard to read and convert, especially on the FPGA where math functions are limited. This set of functions uses FPGA-only IP to convert from the FPGA Timekeeper timestamp to Year, Month, Day, Hours, Minutes, and Seconds. It also calculates the ordinal date (day of the year).

 

Requirements

  • LabVIEW 2012 (or compatible).
  • LabVIEW FPGA Module
  • FPGA Timekeeper

 

Steps to Implement or Execute Code

  1. Place the timestamp returned into the FPGA time (ns) control
  2. Run the code
  3. The corresponding date and time is returned by the indicators

Additional Information or References 

Block Diagram

capture1.JPG

It does this by using the Julian Date calculations described at https://en.wikipedia.org/wiki/Julian_day

 

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

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