Anda di halaman 1dari 2

T

h
i
s

c
o
p
y

d
i
s
t
r
i
b
u
t
e
d

b
y

h
t
t
p
:
/
/
B
I
N
9
5
.
c
o
m
/
PLCCLOCK.RSS
LAD 2 - MAIN_PROG --- Total Rungs in File = 6
Page 1 Saturday, October 05, 2013 - 09:47:47
PLC Clock example by BIN95.com
This is a rung comment. The rung below is 60 second timer, all other rungs are counters driven by this timer. This is referred to as a cascading
programming methodology. You could design this PLC clock several different ways. We picked the most simplest for this example. 60 sec=minute,
60 min=hour, 24 hrs=day,365days=year
0000
I:0
0
1761-Micro
RUN
T4:0
DN
SECONDS/DN
EN
DN
TON
Timer On Delay
Timer T4:0
Time Base 1.0
Preset 60<
Accum 32<
TON
SECONDS
If 60 seconds have elapsed, increment minute counter by 1.
0001
T4:0
DN
SECONDS/DN
CU
DN
CTU
Count Up
Counter C5:0
Preset 60<
Accum 59<
CTU
MINUTES
C5:0
DN
MINUTES/DN
RES
C5:0
MINUTES
If 60 minutes have elapsed, increment hour counter by 1.
0002
C5:0
DN
MINUTES/DN
CU
DN
CTU
Count Up
Counter C5:1
Preset 24<
Accum 6<
CTU
HOURS
C5:1
DN
HOURS/DN
RES
C5:0
MINUTES
If 24 hours have elapsed, increment day counter by 1.
0003
C5:1
DN
HOURS/DN
CU
DN
CTU
Count Up
Counter C5:2
Preset 365<
Accum 61<
CTU
DAYS
C5:2
DN
DAYS/DN
RES
C5:0
MINUTES
T
h
i
s

c
o
p
y

d
i
s
t
r
i
b
u
t
e
d

b
y

h
t
t
p
:
/
/
B
I
N
9
5
.
c
o
m
/
PLCCLOCK.RSS
LAD 2 - MAIN_PROG --- Total Rungs in File = 6
Page 2 Saturday, October 05, 2013 - 09:47:47
This rung/counter gives current years accumulated based on 365 days counted. We pre-plugged to year 2013. You might have expected a rung for
"Current Month" here (1-12), but for simplicity reasons we did not do that logic in the example. (As each month has different number of days in to
and would complicate login more than we wanted to in this example.)
0004
C5:2
DN
DAYS/DN
CU
DN
CTU
Count Up
Counter C5:3
Preset 30000<
Accum 2013<
CTU
CURRENT_YEAR
C5:3
DN
CURRENT_YEAR/DN
RES
C5:3
CURRENT_YEAR
0005 END

Anda mungkin juga menyukai