Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 22 of 29

1772 Mini PLC-2/05 Processor (Cat. No. 1772-LS, LSP) Programming and Operations Manual, pages 211 to 220

Pages 211 to 220 of 289

The original document is the PDF (1.4 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Allen-Bradley 1772-LSP

Page 211

Chapter 18 Programming Techniques

The technique shown in Figure 18.3 is used when your program does not contain any other Master Control Restart instruction. The technique shown in Figure 18.4 is an alternative if an unused Label instruction (chapter 13) is available. Figure 18.3 Automatic Restart Using an MCR Instruction 027 MCR 01 USER PROGRAM

MCR 027 U OFF 01

Figure 18.4 Automatic Restart Using JMP Instruction 06 JMP

027 01 USER PROGRAM

06 LBL

027 U OFF 01

The values in the data table at start-up depend on whether or not memory was retained by the back-up battery. If a battery was used, the data table contains the values that existed when power was removed. If a battery was not used, the values programmed into EEPROM transfer into the data table at power-up. Start-up conditions for automatic start-up (using one of the suggested programming techniques) are: initial start-up: remove the battery from the system in-process start-up after power loss: maintain battery back-up

18-3

Page 212

Chapter 18 Programming Techniques

Switches on the switch assembly of the I/O chassis determine how and when EEPROM to CMOS RAM transfer occurs. A transfer takes place when any change of CMOS RAM memory content occurs while the battery is being changed. If a transfer occurs (memory was altered), the data table contains the values programmed into the EEPROM. If transfer did not occur, memory did not change. The data table contains the values that existed at the time system power was removed.

Cascading Timers

Cascading is a programming technique that extends the ranges of timer and/or counter instructions beyond the maximum values that may be accumulated. Figure 18.5 illustrates a 24-hour clock program. Again, we emphasize not to enter these instructions using your on-line production equipment. Figure 18.5 24 Hour Clock 030

Rung 1

15 030

Rung 2

15 031

Rung 3

15 031

Rung 4

15 032 15

Rung 5

030 TON 1.0 PR 060 AC 005 031 CTU PR 060 AC 000 032 CTU PR 060 AC 000 032 CTR PR 060 AC 000 032 CTR PR 024 AC 000

ATTENTION: Do not use the clock program as a real time clock device. Failure to observe this caution may result in an inaccurate program.

18-4

Page 213

Chapter 18 Programming Techniques

A synopsis of the operation’s cycle is:

Temperature Conversions

Rung 1:

When the conditions are true the timer starts.

Rung 2:

When AC=PR (accumulated value equals preset value) of the timer, counter 031 increments.

Rung 3:

When AC=PR of counter 031, counter 032 increments.

Rung 4:

When AC=PR of counter 031, 031/15 resets counter 031’s accumulated value.

Rung 5:

When AC=PR of counter 032, 032/15 resets counter 032’s accumulated value.

Do not use the following examples to program online production equipment. These examples are for demonstration purposes only. Application One This application illustrates the conversion of temperature from degrees Celsius to degrees Fahrenheit (Figure 18.6). Figure 18.6 Converting Temperature Values 200 G 100 203 G 900 205 G 180 210 G 212

201 G 009 204 G 005 207 G 032 211 < 190

203 202 X X 900 000 206 205 : : 180. 000 210 + 212 033 TON 1.0 PR 003 AC 000

033

011

15 033

15 034 CTU PR 999 AC 000 011 L 16 011 U 16

17 210 220 G = 212 212 110 14

18-5

Page 214

Chapter 18 Programming Techniques

Connect a thermocouple to an input module which measures Celsius temperature. A block transfer read transfers the temperature into the processor’s data table. Convert the recorded Celsius temperature in the data table to Fahrenheit values for display (Formula: oF = (9/5oC) + 32). This temperature must maintain certain range values for your application. You want to: monitor the temperature between 87o to 100oC count the times the value falls below 190oF count the timers the values stay at 212oF Here is an explanation of each rung: Rung 1:

The Get instruction at address 200 multiplies the temperature 100oC by 9 and stores 900 in address 203.

Rung 2:

The Get instruction at address 203 divides 5 into 900 and stores the quotient, 180, in address 205.

Rung 3:

The Get instruction at address 207 adds 32 to the value 180 which is located at get addresses 205. The sum of 212 is stored at address 210. Thus 100oC = 212oF.

Rung 4:

If the displayed temperature is less than 190oF, the timer initiates timing for three seconds.

Rung 5:

If three seconds have elapsed, an output at address 011/15 energizes a heating device that brings the temperature back into the desired range.

Rung 6:

Counter 034 counts the number of times the value falls below 190oF. Therefore, when rung 4 is true the counter increments.

Rung 7:

When the temperature equals 212oF latching 011/16 enables an alarm.

Rung 8:

To shut the alarm off, unlatch 011/16. To do this, an operator would press a pushbutton connected to address 011/16.

Application Two This application is similar to application one, but it only records the converted temperature reading every five seconds (Figure 18.7).

18-6

Page 215

Chapter 18 Programming Techniques

Figure 18.7 Recording Temperature Values Every 5 Seconds 030

030 TON 1.0 PR 005 AC 000 02 JSR

15 030 15 06 LBL 203 G 900 205 G 180

Subroutine Area 203 202 X X 900 000 206 205 : : 180. 000 210 + 212

200 201 G G 100 009 204 G 005 207 G 032

RET

Here is an explanation of each rung: Rung 1:

When rung 1 is true, the timer (this is an example of a free running timer) starts timing.

Rung 2:

The JSR instruction jumps to the subroutine area label instruction when the timer’s accumulated value reaches 5 seconds.

Rungs 3–5:

Converts Celsius temperature to Fahrenheit temperature exactly as in application one.

Rung 6:

The Return instruction signals the processor to return to the main program area.

ATTENTION: Make allowances for conditions which could be created by the use of the Jump to Subroutine instruction. Subroutine program rungs are not scanned by the processor unless initiated by the Jump to Subroutine is initiated by the main program. The processor does not scan the subroutine program unless initiated by a Jump to Subroutine in the Main Program. Timers and counters within these rungs cease to function. You should reprogram critical rungs in the main program area.

18-7

Page 216

Chapter 18 Programming Techniques

Program Control

This application illustrates the program control instructions, master control reset (MCR) and zone control last state (ZCL) (Figure 18.8). Figure 18.8 Program Control 110

MCR

17 110

011 15

16 Master Control Reset 110

MCR

ZCL

17 110

011

16

15 RET Zone Control Last State

Common applications such as varying either packaged size or receipt ingredient use these instructions. For example, packaging a product in two different size of packages or converting a food product to a dietary food product by changing its sugar content. Before you program these two instructions, think about how you want outputs to react when you change the process or operation. Using the MCR instruction, rung logic shows: If address 110/17 is false, then bit 011/15 is energized if 110/16 is set. This is normal operation. If address 110/17 is true, then bit 011/15 is reset regardless of the state of 110/16. Using the ZCL instruction, rung logic shows: If address 110/17 is false, then bit 011/15 is energized if 110/16 is set. This is normal operation. If address 11/17 is true, then bit 011/15 if left in its last state regardless of the state 110/16. All outputs within a ZCL zone are left in their last state when the zone is disabled (start fence is false).

18-8

Page 217

Chapter 18 Programming Techniques

Bottle Filling Application

This application starts when a bottle is placed on a conveyor, it ends when the bottle is filled and ready for the next sequence of operations. This application is totally automated. This application is only for demonstration purposes. Do not try to program this application using your online production equipment. Documenting Your Program Here is a list of tasks for you to practice good documentation habits. This task:

Is this:

Task 1

Write out the sequence of operation that would explain the production process.

Task 2

Make two lists: one for input devices and one for output devices.

Task 3

Complete the sequence worksheets which are located in this chapter. They are NO TAG and NO TAG. Additional worksheet are available through your local Allen-Bradley distributor or sales engineer.

Task 4

Write out your processor's program using the sequencer instructions.

Task 5

Program your processor. Test out the program then place your worksheets and all related information in a notebook for future reference.

Task 1: Sequence of Operation 1.

Four bottles are placed at the beginning of a moving conveyor.

2.

The bottles are at station one ready to be filled.

3.

Each bottle actuates a photocell indicating that each bottle is present.

4.

One fill tube is inserted into each bottle.

5.

The file tubes fill each bottle for three seconds.

6.

The file tubes are removed from each bottle.

7.

A solenoid moves the bottles to the next station.

18-9

Page 218

Chapter 18 Programming Techniques

Task 2: Lists Your Devices Input Devices The input devices and their abbreviations are: Input Device Photocell Fill tube extended FIll TUbe retracted Automated Timer

Abbreviation PC LS1 LS2 Auto Timer

Comment Bottle in Place Limit Switch Limit Switch Type of Operation 3 Seconds

Output Devices The output devices and their abbreviations are: Output Device

Abbreviation

Conveyor motor Conveyor motion forward Fill tube motor Fill tube forward Fill tube filling Fill tube reverse Solenoid

CM CMF FTM FTF FTS FTR SOL

Comment Initializing motion

Fluid starts to flow Moves the bottles off the conveyor

Task 3: Completing Your Worksheets Figure 18.9 and Figure 18.10 illustrate completed sequencer worksheets. Notice that the first step of the sequencer output is the last step of your operation. Table 18.A describes each step. To aid you in understanding this documentation concept, read table 18.A while looking at each figure.

18-10

Page 219

Chapter 18 Programming Techniques

Figure 18.9 Completed Sequencer Input Worksheet ALLEN-BRADLEY Programmable Controller

PROJECT NAME

SEQUENCER TABLE BIT ASSIGNMENTS

PAGE

PROCESSOR

Mini–PLC–2/05

DATA TABLE ADDR

TO

Bottle Filling Applications

DESIGNER

Engineer

COUNTER ADDR:

200

FILE

WORD ADDR:

110

Timer 200

MASK ADDR:

070

071

WORD #1

TO

413

10 07

SEQ LENGTH:

006

WORD #3 00 17

10 07

WORD #4 00 17

10 07

00

Timer

PC

LS2

00 17

LS1

Auto

D E N V A I M C E E

400

WORD #2

10 07

2

Input

SEQUENCER

17

OF

1

MASK STEP

1 2 3 4 5 6

FROM ADDR TO ADDR

Note: A filled in box means that each device is actuated.

10145-I

18-11

Page 220

Chapter 18 Programming Techniques

Figure 18.10 Completed Sequencer Output Worksheet ALLEN-BRADLEY Programmable Controller

PROJECT NAME Bottle DESIGNER

SEQUENCER TABLE BIT ASSIGNMENTS

PAGE

PROCESSOR

Mini–PLC–2/05

DATA TABLE ADDR

TO

Filling Applications

Engineer SEQUENCER

200

FILE

WORD ADDR:

012

600 013

MASK ADDR:

075

076

WORD #1

10 07

2

613

006

SEQ LENGTH:

WORD #3 00 17

10 07

WORD #4 00 17

10 07

00

Timer

CM

CMT

00 17

FTM

FTR

SOL

FTF

FTS

D E N V A I M C E E

TO

WORD #2

10 07

OF

Input

COUNTER ADDR:

17

1

MASK STEP

1 2 3 4 5 6

FROM ADDR TO ADDR

Note: A filled in box means that each device is actuated.

18-12

10148-I