Example Code

Calibrate Real-Time Target Date/Time with NIST Programmatically

Code and Documents

Attachment

Download All

Do you need to calibrate your Real-Time (RT) system's Date/Time every couple of months? Do you use NIST to get the info and then apply it yourself? Well this VI shows you how to access the NIST Time Servers online and then apply that information to your RT system programmatically. For more information on the NIST Time Servers, please visit their website at http://tf.nist.gov/tf-cgi/servers.cgi. This VI opens up a TCP Connection to these NIST Time Servers which are online, gathers the Date/Time information, parses it out and bundles it into usable cluster, and then applies it to the RT system. I coded this in LabVIEW 8.6.1, but I am posting a picture of the Block Diagram so you can recreate yourself in a lower version if you need it. There are two VIs (GetNISTTime and CalibrateRTSystemTime) attached. CalibrateRTSystemTime is the main VI that calls GetNISTTime. CalibrateRTSystem uses GetNISTTime to get the needed date and time clusters and then uses RT Set Date and Time.vi to apply it to the RT system.


*NOTE* Make sure and put these under the RT Target in the Project Explorer BEFORE you open CalibrateRTSystemTimeLV861.vi because the RT Set Date and Time.vi is only available when the VI is hosted on a RT Target. If you try and open it before you do this, the VI will look for RT Set Date and Time.vi and will not be able to find it.

CalibrateRTTime.PNG

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

Comments
Todd S.
NI Employee (retired)
on

Love it! Nice work G-Money!

Todd S.
LabVIEW Community Manager
National Instruments
Contributors