Author Topic: Get system time and write to Micrologix 1400  (Read 2863 times)

mjpatera

  • Newbie
  • *
  • Posts: 3
    • View Profile
Get system time and write to Micrologix 1400
« on: November 03, 2015, 02:56:52 PM »
Is there a way that I can have my HMI get the time that is on the computer and write it to an integer file in a Micrologix 1400 processor? The processor doesn't have a real time clock so I am using timers to keep up with the time. I have been running it for about 3 weeks now and the time has only got off by about 10 seconds which isn't a big issue but during power outage the time has to manually be reset. I am currently using a digital panel meter to display and change the time if needed but I would like to make it so I can just click an "update" button and have it do this for me. Another alternative which would work even better for me is for it to update the time as soon as the HMI program is started.

Thanks in advance.
Mark

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Get system time and write to Micrologix 1400
« Reply #1 on: November 03, 2015, 05:27:13 PM »
- Double click the MainForm in a blank area. This will take you to the code for the FormLoad event handler
- Add this code:
Code: [Select]
EthernetIPforSLCMicroCom1.Write("N7:0",Now.Hour)
EthernetIPforSLCMicroCom1.Write("N7:1",Now.Minute)
EthernetIPforSLCMicroCom1.Write("N7:2",Now.Second)