How to Synchronise NB time via CP1L

Updated November 06, 2023

This document is intended to provide the instructions necessary to automatically synchronize the NB HMIs real time clock (date and time) to the CP1L system clock. There are many reasons that this may be desirable, such as clock consistency between machines, more accurate timestamp on error logs, etc.


While it is not covered in this article, the EtherNet port on CP1L also supports Automatic Clock Adjustment using NTP (Network Time Protocol). This function relies on a PC running the NTP Server, either locally in the customers facility, or externally using Internet servers such as ntpool.org or ntp-d.nist.gov. 
 

1. Configure the PLC 

The PLC has a a real time clock (RTC) on board which tracks the current system time. The data is stored in memory in a BCD format. 

In order to use this data we must separate each increment into discrete words and convert them to binary. 

  1. Initialise the target memory area -
  2. Copy the digits from the A area to the D area
  3. Convert from BCD to binary. Add 2000 to the year.
 
 

2. Configure the HMI

The RTC is stored in the LW area on the NB screen. We will need to configure a function that automatically transfers all the required words from the PLC to the NB screen. The Data Transmission tool can be used to accomplish this.

The RTC is structured as below on the NB screen.

  1. Add a Date/Time component (Optional)
  2. Add a Data Transmission component. Set the Source word and result word. Ensure that the Data Length is set to 7.
  3. Configure a trigger signal. 
  4. Add a push-button to trigger the Data transmission.

     

The program has now been completed. When the push-button is pressed, the NB time will be synchronised to the PLC time.

 
 

CP1L and NB Sample Projects

Start a Conversation
This conversation is closed
Uploading...