Host Engineering Forum

General Category => DirectSOFT => Topic started by: PStiles on August 31, 2010, 07:43:26 AM

Title: Time of Day and Day of Week
Post by: PStiles on August 31, 2010, 07:43:26 AM
Is there a example somewhere let I can download that show how to turn a output on and off at certian times of the day and on certain days of the week.

What I would like to do is turn a output off Monday thru Friday between the hours of 8:00 am and 4:00 pm. The out put would be on all other times.

CPU is a 440
Title: Re: Time of Day and Day of Week
Post by: b_carlton on August 31, 2010, 09:06:35 AM
So you want to turn the output on if:

It is Saturday

OR

It is Sunday

OR

It is before 8 AM

OR

It is after 4 PM


Now, can you turn that into a rung using the day/time information?
Title: Re: Time of Day and Day of Week
Post by: PStiles on August 31, 2010, 09:16:08 AM
Yes this is what I am looking to do. Is there a example that I may look at, not sure how to start.
Title: Re: Time of Day and Day of Week
Post by: b_carlton on August 31, 2010, 10:26:44 AM
In your previous thread you ended up creating a rung. You will create 1 rung.

You will use the day and time information in the PLC. Do you know where that is?

You will use compare functions. Are you confused about those?

What is the specific problem?
Title: Re: Time of Day and Day of Week
Post by: PStiles on August 31, 2010, 11:18:21 AM
I do not understand how to access the time and day info in the PLC. Is there documentation that shows an example that I can use to extrapolate this programming from?
Title: Re: Time of Day and Day of Week
Post by: b_carlton on August 31, 2010, 11:48:05 AM
Do you have the manual for the CPU, either in printed or PDF form? Do you know the V registers where the time/date information is stored?
Title: Re: Time of Day and Day of Week
Post by: b_carlton on August 31, 2010, 11:57:17 AM
Here is a test for Sunday

Title: Re: Time of Day and Day of Week
Post by: PStiles on August 31, 2010, 01:42:23 PM
Thanks for the start.  I have the day of week working, but the time of day does not. Below is my program.

PLC 440

// Rung 1
// Address 0
STRE V7771 K2
ANDN V7770 K8
AND V7770 K16
OUT Y40

// Rung 2
// Address 7
END

// Rung 3
// Address 8
Title: Re: Time of Day and Day of Week
Post by: b_carlton on August 31, 2010, 02:01:06 PM
Say the instructions out loud (at least it helps me)

STRE V7771 K2 - If it's Monday
ANDN V7770 K8 - And it's earlier than 8 AM
AND V7770 K16 - AND its later than 4 PM (huh?)


Do you know how to make an OR operation in ladder logic?
Title: Re: Time of Day and Day of Week
Post by: PStiles on August 31, 2010, 02:34:12 PM
I do understand and and or logic. The reason I tried it the way in my program is I am asking if it is Monday between 08:00 am and 4:00 pm turn Y40 off. If it is after 4:00 pm or before 08:00 am, turn Y40 on.
Title: Re: Time of Day and Day of Week
Post by: PStiles on August 31, 2010, 03:09:13 PM
The day of the week and the time less then 08:00 am works. The issue is with the greater then 4:00 part, any suggestions?
Title: Re: Time of Day and Day of Week
Post by: PStiles on August 31, 2010, 03:33:02 PM
After reading the manual there are no examples of the or function. While I understand the concept, I do not understand how to make on. Could you providea example?
Title: Re: Time of Day and Day of Week
Post by: PStiles on August 31, 2010, 03:38:18 PM
Thanks for your help. I figured it out.