Time clock software for AB5

llarson

Guest
L
Ga-day, I have a complicated time clock program to blow the start/stop
and break horn where I work. I have to alter the times every month or two. Would anyone havs a simple program? I am running RS/Logics
 
S:21 = Hours of the Day
S:22 = Minutes
S:24 = Seconds

Compare these to your preset in any integer register or a number and set an output. If you have to change them too often, you may want to add a panelview to change these integer valus.


[/b][attachment][/b]

ladder.gif
 
Dont have the code anymore but the first post is a start. What I did was set up a table in the PLC for hours and minutes. I determined that the horn blew a maximum of six times per hour. So I set up a rung like the one above with branches for the minutes set at when I wanted to blow the horn. To avoid writing 24 lines of logic I used one set of registers for the current horn blowing logic and when the hour changed (minutes and seconds = 0 with + a oneshot) I moved the data from the table to the set of registers used to blow the horn. I used indirect addressing to point to the correct set of registers. I setup a screen in RSView to allow me to change the value of the regisiters quickly. If you dont use all six of the times setup per hour then just set the minutes in the register to something bigger than 59. You will also need to use a timer to set how long you want to blow the horn. For a while I read the current time from the PC running RSView but the clock on that PC kept loosing several minutes a month. You will not believe how important a few minutes are to the guys who have to get to their station before the horn blows. Anyway use the PLC clock it seems to keep time better. Of course then you will have to write code to deal with daylight savings time....
 
Thank you Gentlemen,
It is the code that that I seek.
I am installing an Omron Zen PLC that will that will send a zero sink pulse at
3:00 am to a move command to move a 3 into S21 and a 0 into S22. I plan to do this once a week.
This should solve the wretched A-B clock inaccuracy in our 5-40.
The Zen will also look after the time changes, spring and fall.
But the code we wrote seams far to complicated and uses 26 rungs.
To cover the 2 shifts and the no horn on the weekends.
It works well until we are asked to change the horn times.
Then it’s a challenge to get it right the first time.
.
 
So, there were actually two issues...

1. Synchronizing the AB with the Zen
2. Modifying horn operation times

It sounds like you have the synchronizing part under control.

Now, as far as modifying horn operation times, how exactly are you changing those times?

Are you using some sort of display (HMI) to edit times?

Or are you going into the code and changing hard-coded values?
.
.
.
I created a routine that lets the operators modify system time and date. The routine is available on one of the pages on the display.

The display looks something like this...

TIME DATE
HH : MM : SS MM : DD : YY

EDIT TIME EDIT DATE
HH: __ MM: __

MM: __ DD: __

SS: __ YY: __

F1 = Update Time F10 = Update Date

F30 = Spring Ahead F40 = Fall Back


.
If you are using Daylight Saving Time at all...

Since you are using the Zen to synchronize time, the Daylight Saving Time adjustments would have to be controlled automatically by the Zen (just like it is in Windows). The Zen has to self-correct on those days.

Can the Zen handle that?

Changing Time and Date...

In my routine, the operator enters the HH, MM & SS and then presses F1 to update the time in a single action. Likewise for the date.

For Daylight Saving Time he simply presses F30 or F40, whichever is appropriate.

Now, if you are using some kind of display...

You could do something like this...

CURRENT HORN TIMES EDIT HORN TIMES

Horn-1: HH : MM : SS HH: __ MM: __ SS: __

Horn-2: HH : MM : SS HH: __ MM: __ SS: __
* *
* *
* *
Horn-X: HH : MM : SS HH: __ MM: __ SS: __

F1 = Update Horn Times F10 = Cancel (Clear Edits)


.
The HH, MM & SS values on the left are the current values for each horn time. These values exist in the hard-coded "Working Memory" locations used by the compare instructions. Notice that the "locations" are hard-coded, not the "values".

The "XX: __" values on the right side are all "Edit Memory" locations.

The initial values in the "Edit Memory" locations are equal to the current values in the corresponding "Working Memory" locations. For example, when the screen is first displayed, Horn-1 shows the following...


CURRENT HORN TIMES EDIT HORN TIMES
"Working Memory" "Edit Memory"
Horn-1: 16 : 30 : 00 HH: 16 MM: 30 SS: 00


.
Enter any changes you want into the "Edit Memory" locations on the right side of the screen for any or all horn-events. After you are satisfied that all of the Edit values are correct, then press F1 to Update Horn Times.

All of the data in the "Edit Memory" locations are written to the corresponding "Working Memory" locations. Any values that you have not changed remain the same. After the update is complete, all of the corresponding values on each side are equal.

If the memory locations are properly organized then the update operation can be as simple as a single Block-Copy from Edit-Area to Working-Area.

If horn-times occur at the same relative times from shift to shift...
(assuming three 8-hour shifts...)

shift-start = end-shift/begin-shift horn
shift-start + 2 hours = begin-break horn
shift-start + 2 hours + 10 minutes = end-break horn
shift-start + 4 hours = begin-lunch horn
shift-start + 4 hours + 30 minutes = end-lunch horn
shift-start + 6 hours = begin-break horn
shift-start + 6 hours + 10 minutes = end-break horn


.
Then you might only need to provide a single base-time entry and 6 "off-set" times. (Oh, yeah... also an entry for Day-of-Week to prevent the horn from operating on the weekend.)

If "base-time" = 07:00 then...
Shift-1 start = "base-time" = 07:00
Shift-2 start = "base-time" + 8 = 15:00
Shift-3 start = "base-time" + 16 = 23:00

Off-Set times Shift-1 Shift-2 Shift-3
shift-end/start............................... 07:00 15:00 23:00
begin break shift-start + 2 hrs + 00 min.... 09:00 17:00 01:00
end break shift-start + 2 hrs + 10 min.... 09:10 17:10 01:10
begin lunch shift-start + 4 hrs + 00 min.... 11:00 19:00 03:00
end lunch shift-start + 4 hrs + 30 min.... 11:30 19:30 03:30
begin break shift-start + 6 hrs + 00 min.... 13:00 21:00 05:00
end break shift-start + 6 hrs + 10 min.... 13:10 21:10 05:10


.
It would probably be a lot easier to simply use minutes per shift.

An 8-hour shift has 480 minutes. Use a 1-minute timer to increment a counter. Then monitor the current count.

Begin first break @ 2-Hr + 00-Min.....120 Min.
End first break @ 2-Hr + 10-Min.....130 Min.
Begin Lunch @ 4-Hr + 00-Min...........240 Min.
End Lunch @ 4-Hr + 30-Min...........270 Min.
Begin second break @ 6-Hr + 00-Min....360 Min.
End second break @ 6-Hr + 10-Min....370 Min.
End Shift, Reset Counter @ 8-Hr + 00-Min...480 Min.


.
There are many ways to play this game...

There is a general rule that many programmers just can't seem to get the hang of...

It takes a lot of code to make something appear simple. There is a "cost" associated with convenience. If you want the convenience, the "cost" must be paid.

(170)
 
Ga-day.
I used shahn4 idea in RSLinks minus the seconds, fed a timer
and used a TT bit from it to control the horn duration.
TT Horn
----[]---( )---
Looks like it will work.
I'm just haveing a wee bit of problem cancelling Sat + SUN.
All on one rung so far
THANK YOU ALL
 

Similar Topics

Dear Kind advisors, I need help on the title mentioned subject. The logic i wrote as attached is working and will update the CPU time clock after...
Replies
15
Views
14,852
We recently purchased a IC693CPU352 module and it appears the internal time clock is static. I can set the time and date but once set it does not...
Replies
5
Views
170
Hello. I cannot change the SendClock settings for a PROFINET IO device. I need to slow down the CODESYS PROFINET IO controller. What am I doing...
Replies
0
Views
198
Hello everyone, I am not a programmer, but I can do some simple programming. So now I want the time to be recorded every time a pump turns on. I...
Replies
35
Views
2,704
Hello, I am trying to create an AOI that will retrive the clock datetime bits from a master plc through a generic message read instruction and...
Replies
2
Views
493
Back
Top Bottom