Author Topic: Time/Date  (Read 12113 times)

MarkWater

  • Newbie
  • Posts: 10
  • I'm a llama!
    • View Profile
Time/Date
« on: August 13, 2014, 12:26:10 PM »
Are you able to change the time and date of a SmartTile through an HMI via modbus?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Time/Date
« Reply #1 on: August 13, 2014, 02:16:53 PM »
Yes, the RTC data on the SmartTILE-Fx are mapped to the following Modbus register address (zero offset):

TIME[1] : 512
TIME[2]:  513
TIME[3]:  514
DATE[1]:  516
DATE[2]:  517
DATE[3]:  518
DATE[4]:  519

You can use Modbus function 03/04 to read these registers and Function 06/16 to write to these registers.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

MarkWater

  • Newbie
  • Posts: 10
  • I'm a llama!
    • View Profile
Re:Time/Date
« Reply #2 on: August 13, 2014, 07:09:11 PM »
Perfect! Thanks!

MarkWater

  • Newbie
  • Posts: 10
  • I'm a llama!
    • View Profile
Re:Time/Date
« Reply #3 on: August 20, 2014, 03:01:00 PM »
Is there a easy way to switch between 12-hour time vs 24-hour time. Or does a custom function need to be written?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Time/Date
« Reply #4 on: August 20, 2014, 06:11:05 PM »
The real time clock data is only expressed in 24 hours format. But you can easily display it as 12 hours with simple IF statement:

IF (TIME[1] > 12)
    A$ = STR$(TIME[1]-12)+":"+STR$(TIME[2])+STR$(TIME[3])+" PM"
ELSE
    A$ = STR$(TIME[1])+":"+STR$(TIME[2])+STR$(TIME[3])+" AM"
ENDIF

SETLCD 1,1, "Time = " + A$
Email: support@triplc.com
Tel: 1-877-TRI-PLCS