2
This copy distributed by http://BIN95.com/ 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

PLC Programming Example - PLC Clock

Embed Size (px)

DESCRIPTION

A most simple PLC programming example for those starting out with PLC programming.

Citation preview

Page 1: PLC Programming Example - PLC Clock

This copy dist

ributed by http

://BIN

95.com/

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.comThis 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 cascadingprogramming 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

0000I:0

0 1761-Micro

RUNT4:0

DN

SECONDS/DN

EN

DN

TONTimer On DelayTimer T4:0Time Base 1.0Preset 60<Accum 32<

TONSECONDS

If 60 seconds have elapsed, increment minute counter by 1.

0001T4:0

DN

SECONDS/DN

CU

DN

CTUCount UpCounter C5:0Preset 60<Accum 59<

CTUMINUTES

C5:0

DN

MINUTES/DN

RESC5:0

MINUTES

If 60 minutes have elapsed, increment hour counter by 1.

0002C5:0

DN

MINUTES/DN

CU

DN

CTUCount UpCounter C5:1Preset 24<Accum 6<

CTUHOURS

C5:1

DN

HOURS/DN

RESC5:0

MINUTES

If 24 hours have elapsed, increment day counter by 1.

0003C5:1

DN

HOURS/DN

CU

DN

CTUCount UpCounter C5:2Preset 365<Accum 61<

CTUDAYS

C5:2

DN

DAYS/DN

RESC5:0

MINUTES

Page 2: PLC Programming Example - PLC Clock

This copy dist

ributed by http

://BIN

95.com/

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 toand would complicate login more than we wanted to in this example.)

0004C5:2

DN

DAYS/DN

CU

DN

CTUCount UpCounter C5:3Preset 30000<Accum 2013<

CTUCURRENT_YEAR

C5:3

DN

CURRENT_YEAR/DN

RESC5:3

CURRENT_YEAR

0005 END