Contact and Coil | Nearly In Control

Jun/10

18

Reading the ControlLogix System Time in Ladder Logic

Since I’m in the tutorial mind-set right now, I thought I’d mention this little gem. Here’s how you can read the ControlLogix (or CompactLogix) PLC system time into a UDT so you can use the current time value in your ladder logic program.

First I created a UDT called “TIME”:

RSLogix 5000 - Read System Time - UDT

Then you just need to use the GSV (Get System Value) instruction with the WallClockTime class, and LocalSystemTime attribute to read the controller’s time into an instance of your UDT (here I created a new tag called LocalDateTime of type TIME). Note that I used the Year element of the LocalDateTime tag as the parameter, because that’s the first address of the tag. It starts writing there but fills in the entire UDT with the time values:

RSLogix 5000 - Read System Time in Ladder Logic

Now you can program your sprinklers to turn on and off in the middle of the night! :)

·

2 comments

  • Steve · August 18, 2010 at 10:43 pm

    Needed something like this to transfer system time to an rsview register for an event time stamp.
    still struggling with defining the tag values, and getting the proper response.
    can you send me the exact step by step, I intend to use a one shot to fire it

  • Author comment by Scott Whitlock · August 19, 2010 at 12:17 am

    @Steve, unfortunately I don’t have a running ControlLogix around here right now, so I can’t go online and verify it. But the steps are straightforward: create the UDT as shown above, create one (controller scrope) tag called LocalDateTime of type TIME, and then enter the GSV instruction shown above. However, you’ll need some logic to fire it. I believe it’s an asynchronous instruction, so a one-shot may not work. Check the F1 help docs to be sure.

Leave a Reply

<<

>>

Theme Design by devolux.nh2.me