Do Time sync of PLC with PC

<< Click to Display Table of Contents >>

Manual > Monitoring system construction guide > Server logic construction >

Do Time sync of PLC with PC

overview

This section explains a sample that synchronizes the time between a PC and a PLC. This sample gets the time from the PC and writes it to PLC.

 

The Time sync action is a function that writes PC time information to PLC (tag). Information from the year to the second is written to separate tags, and the ladder on the PLC side processes the written date information into a time that matches the PLC format, synchronizing the time.

 

c_action_0238

 

Action used: Time sync action

 

 

Download the sample

The creation examples shown on this page are provided with samples.

 

The sample can be downloaded from below.

 

Use action: Time sync action

 

 

Operation check

Load the sample server configuration file from FA-Server and bring the application online (yellow arrow).

 

After going online, write TRUE to U01.F01.T01 and verify that the PC time is written to the tag.

 

 

Setup Procedure

Tag configuration

 

1.Set tags.
 
c_action_0225

 

Tag Name

address

the purpose

YEAR

D0000

Tag to write the year

MONTH

D0001

Tag to write the month

DAY

D0002

Write the date tag

HOUR

D0003

Tag to write the time

MINUTE

D0004

Tag to write minutes

SECOND

D0005

Write the second tag

U01.F01.T01

X0000

A tag that triggers an action

 

 


Action Settings

 

1.Time syncRegister action "A01".
 
c_action_0226
 

2.From the Shutdown tab, configure the screenshot settings.
 
c_action_0227
 

Synchronization method: Set the computer's time to the PLC (tag)

Check year "U01.F01.YEAR"

Check the month "U01.F01.MONTH"

Check the day "U01.F01.DAY"

Check "U01.F01.HOUR"

Check the minute "U01.F01.MINUTE"

Check the second "U01.F01.SECOND"

 

 


Event Settings

 

1.Create a Tag event to perform the action.

 

In this example, we will set the event to occur when U01.F01.T01 becomes TRUE.

 
c_action_0132

 
Set the execution action to "A01".
 
c_action_0365

 

 

Application of this sample

This sample introduced an example of a process for writing the PC time to a PLC, but by selecting "Set the PLC( tag) time to the PC" in the synchronization method settings, you can change the PC time based on the PLC date and time data.

 

 

attention

To change the PC time using this action, you must be logged in as a user with administrator privileges that allow you to change the time.