Example Code

Synchronize System Time to GPS Signal Using PXI-6682(H) and Windows/RT OS

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

  • Modular Instrumentation

    Software

  • LabVIEW

    Driver

  • Other

Code and Documents

Attachment

Overview
Demonstrates how to use the specified instrument GPS time to set the system clock to that value.

 

Description
This VI programmatically sets the time reference and displays the time reference properties continuously. When setting the time reference to IRIG you'll need to indicate the type of IRIG being used. For IRIG or PPS you will need to indicate the time reference terminal.

It collects the GPS time through the PXI-6682 and then sets the system clock to that value. If on RT, it saves this change to the system (not necessary for Windows) and then displays both the GPS time used and the System time so that you can confirm synchronization. It also gives you the option to set the Windows OS clock through calling into the kernel32.dll.

 

Requirements

Software:

  1. LabVIEW 2012 (or compatible)
  2. NI-Sync14.0(or compatible)


Steps to Implement or Execute Code

  1. Initialize the NI-SYNC driver. And reset to default state.
  2. Set the time reference of the device related to the specified instrument handle.
  3. Get the board time associated with the specified instrument handle.
  4. Choose whether to set windows clock.
  5. Save the time change.
  6. Close the session.

 

Additional Information or References
VI Snippet

1111.png

 

**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.

Comments
Mikosim
Member
Member
on

Hi. The alppication isn't working on my computer in RT mode. I have some errors:

C7B9@LabComp.pngCan you help me eliminate the error?

Mikosim
Member
Member
on

Hi Peter_W. Should the program change the computer's time in "window" position? If so, it does not. Why? PrScr.pngWhy?

Peter_W
NI Employee (retired)
on

Hey Mikosim,

I had received a couple of requests regarding that recently so I updated the code. The controller system time and the Windows OS clock aren't the same thing, but the code now has a button to set the windows time as well. Give it a test run and let me know if you still have any issues.

Best Regards,

Peter W.

Mikosim
Member
Member
on

Hi Peter_W. Thank you for yours solution. It work!

LizAsh
Member
Member
on

Hi Peter,

Do you have a copy of the code that update the pc clock?  I downloaded the example at the top of the page but I get the same problem as Mikosim.

Regards,

LizAsh