This FactoryTalk® Optix application example can be used to sync-time between PLC and HMI. The concept is similar to the global connections used in FactoryTalk® Machine Edition application. It is better to synchronize all programs times because directly setting the system time can cause various errors. By centralizing time synchronization through this dedicated function, you can avoid these potential pitfalls and maintain the reliability and stability of your program.
This application note is intended to provide general technical information on a particular subject or subjects and is not an exhaustive treatment of such subjects. Accordingly, the information in this document is not intended to constitute application, design, software or other professional engineering advice or services. Before making any decision or taking any action, which might affect your equipment, you should consult a qualified professional advisor.
ROCKWELL AUTOMATION DOES NOT WARRANT THE COMPLETENESS, TIMELINESS OR ACCURACY OF ANY OF THE DATA CONTAINED IN THIS DOCUMENT AND MAY MAKE CHANGES THERETO AT ANY TIME IN ITS SOLE DISCRETION WITHOUT NOTICE. FURTHER, ALL INFORMATION CONVEYED HEREBY IS PROVIDED TO USERS "AS IS". IN NO EVENT SHALL ROCKWELL BE LIABLE FOR ANY DAMAGES OF ANY KIND INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS PROFIT OR DAMAGE, EVEN IF ROCKWELL AUTOMATION HAVE BEEN ADVISED ON THE POSSIBILITY OF SUCH DAMAGES.
ROCKWELL AUTOMATION DISCLAIMS ALL WARRANTIES WHETHER EXPRESSED OR IMPLIED IN RESPECT OF THE INFORMATION (INCLUDING SOFTWARE) PROVIDED HEREBY, INCLUDING THE IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, AND NONINFRINGEMENT.
Open the attached FactoryTalk® Optix application and follow the steps below:
- Select the RuntimeNetLogic_TimeSync script in the NetLogic folder
- In the properties of the RuntimeNetLogic_TimeSync script you can insert the tags to make the script works:
- year, month, day, hour, minute, second are variables from DateTimeController array (DINT[7]) used in PLC software in the GSV instruction.
- SetSecond, SetHour, SetMinute, SetMonth, SetDay, SetYear are variables for DataTimeToPLC array (DINT[7]) used in PLC software in the SSV instruction.
- DataTimePLC is a NodeID linked to DateTimeController used for the RemoteRead function in NetLogic script.
- SetHMITime is a DateTime variable used in the DateAndTime object for setting the HMI date and time from PLC
- SetPLCTime is a DateTime variable used in the DateAndTime object for setting PLC date and time from HMI dialogbox.
- Run the FactoryTalk Optix application with Emulator and PLC software attached, to try it out
- Wait and check if communication between PLC and HMI to be active.
- Check the actual date and time from PLC.
- Click on “Date Time Dialog” button to set the date and time between PLC and HMI.
- Set and confirm date and time from HMI.
- Click on “Set Date Time” button to send the command to PLC.
Note: Setting the WALLCLOCKTIME object in PLC is limited to no more than one update every 15 seconds.
- Open the controller properties in Studio 5000.
- Check the result and if the date and time between PLC and HMI are synchronized
A sample ACD file is provided in ProjectFiles\PLC_Code\SyncDateTime.ACD




