If the need arises to use specific time in your ladder logic program, this guide will give you a reference to go by.

Possibly you have a cleaning device that only needs to operate once an hour or once a day or maybe you want to operate a whistle at noon every day, the easiest way to accomplish this task would be to use the Controller’s time (which lives in the memory of the controller).

The value of the controller’s clock is not readily available in the controller tag database, but rather you must make a request in the ladder program to access it.

Along with many other attributes available from the controller, you can use a GSV (Get System Value) Instruction to access this attribute.

This short guide will take you through setting up this request and then using it to accomplish a task.

Step 1

Create a line of ladder and in the instruction palette under “Input/Output”, choose a “GSV” Instruction and set up the following:

Class Name:    WallClockTime

Attribute Name: DateTime

Dest: CurrentTime[0] (This is a tag you will create, DINT type with an array of 7)

Image by Brandon Cooper

Step 2

Write your logic changes.

Step 3

Right-Click on “CurrentTime” and Select Monitor to view the tag in the controller tag database

Image by Brandon Cooper

NOTE:

DINT[0] = Year

DINT[1] = Month (1-12)

DINT[2] = Day (1 – 31)

DINT[3] = Hour (0-23) This value is GMT, no matter the controller time zone setting

DINT[4] = Minute (0-59)

DINT[5] = Second (0-59)

DINT[6] = Microseconds (0-999,999) Never had to use it, but I guess it is a possibility


To Activate an Output for a Solenoid on the Hour, Every Hour for five seconds

 Create a new ladder rung with an EQU instruction and use the CurrentTime[4] to see if the “Minute” of the controller time is equal to “0”.

If the controller’s time (in Minutes) is equal to “0”, then start a timer for 5 seconds. During that time, you can use the Timer.TT bit to turn on the output for the solenoid in the same rung or you can add an additional rung as shown below to accomplish this.

Image by Brandon Cooper

Conclusion

Keep in mind there are many attributes to obtain by request to a controller via the GSV (Get System Value) instruction and there is an entire library of information on how to get almost any needed value that you would like to obtain.

Using the controller’s time is just one of them, but a very useful one. I have used it many times for reporting, shift changes, whistles and a myriad of reasons. It is a standard logic that I place in every controller that I set up.

My best to you in making the needed logic changes that need to happen on time, every time!

Written by Brandon Cooper
Senior Controls Engineer and Freelance Writer

Have a news tip? Share it with us here.
Have a question on this topic? Click here to scroll down to the comment link
Enjoy the benifits of membership! Insider news, rewards, & more: Patreon.com/automation

Brandon Cooper


Click HERE to scroll down to view or leave comments


Leave A Blog Reply Here

Please enter your blog comment!
Please enter your name here