You can SYNC The HMI from the PLC but you will find that this approach is more difficult.
The 2 approaches that come to mind:
- Set a RELAY in the PLC to indicate that you want the HMI to set its clock to match the PLC. On the HMI side you need to have a MACRO that executes periodically and checks for this RELAY to be set. The MACRO reads the PLC TIME[] registers and then updates the HMI registers. This macro clears the RELAY to indicate that the HMI has been updated. This approach avoids the issue of the HMI taking longer to start up and eliminates the need for the PLC to be able to change stuff in the HMI.
- Set up the HMI"s MODBUS TCP/IP server and have the PLC change the HMI time registers using Modbus TCP/IP. This is assuming that the PLC and HMI are networked together. In most cases the PLC is slave to the HMI, but to allow the PLC to change things in the HMI requires that the PLC act as a master device. To do this you will need a 2nd path between the the devices. I think that this is making things way too complicated.
You will probably have problems with syncing the clocks on the first scan of the PLC. If the HMI and PLC are powered from the same source, the HMI will take longer to get running then the PLC. You may have to give the HMI some extra time before it is up and running.
The issue with the clocks in the HMI and PLC is that the clocks will drift apart. How many seconds/minutes difference between the HMI and PLC clocks is OK for your application? You may need to sync the clocks more often often depending upon how they drift. You may want to figure out which clock is more accurate over time and temperature and this may determine which clock to use as a reference.
If you need really accurate time and time and do not have access to the net, you might consider using a GPS module as a time reference.
My FX1616 test board drifts less than one second per day! It is running under very ideal conditions. Stable power and temperature. I left it running for several months testing code to sync it to NIST time servers and it only had to re-sync once every few days.
Gary D*ickinson