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

The text of a manual · part 18 of 29

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

Pages 171 to 180 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 171

Chapter 14 Block Transfer

Figure 14.7 Programming Multiple Reads from One Module Inputs 1 2

Inputs 1 2

Inputs 1 2

Input 1 Input 2

3

3

3

Block Xfer Read Data Addr: 052 Module Addr: 141 Block Length: 04 160- 163 File: Block Xfer Read Data Addr: 052 Module Addr: 141 Block Length: 08 160- 167 File: Block Xfer Read Data Addr: 052 Module Addr: 141 Block Length: 03 160- 162 File:

014 EN 07 114 DN 07 014 EN 17 114 DN 17 014 EN 17 114 DN 17 114 DN 17

Input 3

Buffering Data

You should buffer block transfer data to allow the data to be validated before it is used. Data that is read from the block transfer module and transferred to data table locations must be buffered. Data that is written to the module need not be buffered because block transfer modules perform this function internally. Transferred data is buffered to ensure that both the transfer and the data are valid. As an example, readings from an open-circuited temperature sensor (invalid data) could have a valid transfer from an analog input module to the data table. The processor examines data-valid and/or diagnostic bits contained in the transferred data to determine whether or not the data is valid. the block transfer done bit is set if the transfer is valid. The data-valid and/or diagnostic bits differ for each block transfer module. Some modules set one or both for the entire file of words transferred, while others set a data-valid diagnostic bit in each word. See the documentation for the block transfer module to determine the correct usage of the diagnostic and/or data valid bit(s).

14-16

Page 172

Chapter 14 Block Transfer

One technique of buffering data is to store the transferred data in a temporary buffer file. If the data in the buffer is valid, it is immediately transferred to another file in the data table where it can be used. If invalid, it is not transferred but written over in the next transfer. Another technique uses only one file. The technique prevents invalid data from being operated upon by preconditioning the rungs that would transfer data out of a file one word at a time. Diagnostic and/or data-valid bits are examined in these rungs. Data can be moved from the buffer word-by-word using get/put transfers, or the entire file can be moved at once using a File-to-File Move instruction. The choice depends on the kinds of diagnostic and/or data-valid bits and the objectives of the user program. Generally, when one diagnostic bit is contained in each word, a get/put transfer is used. When one is set for the entire file, a File-to-File Move instruction is used. In either case, the diagnostic bits are examined as conditions for enabling the file move or word transfer. The example in Figure 14.8 shows the memory map and ladder diagram rungs for buffering 3 words of data that are read from the block transfer module. The data is read and buffered in the following sequence:

14-17

Page 173

Chapter 14 Block Transfer

Figure 14.8 Buffering Data

R 1 1

0

Block Length Code

4

0

Block Transfer Data (Buffer)

Data in the buffer file 050-052 will be moved to 150-152 when:

030

A. Done Bit 114/07 is set (Valid transfer)

050

B. Diagnostic Bit is TRUE for each word to be moved in rungs 5-7 (valid data)

052

R 1

0

014

0

5

114

0

130 150

Block Transfer Data (Valid)

152

010 00

114 07

Rung 3

111 11

010

Rung 2

010 U

Block Transfer Read Data Addr: 030 Module Addr: 140 Block Length: 03 050- 052 File:

014 EN 114 DN

014

Rung 4

010 L

07 010

050 G 111

Rung 5

051 G 222

Rung 6

052 G 333

Rung 7

150 PUT 111 151 PUT 222 152 PUT 333

02 010 02 010 07

Diagnostic Bit

14-18

Rung 1

02

00 07

07

00

10228-I

Page 174

Chapter 14 Block Transfer

Chapter Summary

1.

When rung 3 goes true, bit 014/07 (the block transfer enable bit) is turned on and block transfer is requested. This latches on storage bit 010/00 in rung 4.

2.

Block transfer is enabled during the program scan. The transfer is performed during an interruption of the next I/O scan. Data from the module is loaded into words 050-052. When block transfer is complete, done bit 114/07 is set in the input image table byte. This indicates block transfer was successfully performed. The processor then continues with the I/O scan and program scan.

3.

During the program scan, rung 1 is true because bit 010/00 is still latched on. Bit 114/07 (the block transfer done bit) is on because block transfer was performed. This turns bit 010/02 on. In rung 2, bit 10/00 is then unlatched.

4.

In rung 5, bit 010/02 is still on and a diagnostic bit is examined to ensure the data read from the module is valid. Assuming the data is valid, the diagnostic bit is on and the data is transferred from word 050 to 150. In rungs 6 and 7, the data in words 051 and 052 is transferred to words 151 and 152 if the diagnostic bit is on.

In this chapter, we showed you how to transfer a block of data in one scan. The next chapter shows you how to perform subroutines at timed intervals.

14-19

Page 175

Chapter

15

Selectable Timed Interrupt

Chapter Objectives

This chapter describes a method to execute subroutines at timed intervals. This method is called selectable timed interrupt.

Introduction

Selectable timed interrupt is a special subroutine that can be programmed into the subroutine area and designated as a Selectable Timed Interrupt (STI). This subroutine can then be executed at timed intervals. General programming facts are: First instruction is the first rung of the subroutine area must be a Get instruction. This identifies it as an STI. Get instruction must be used solely for the purpose of designating the time period of the STI. STI subroutine execution time should not exceed approximately 2/3 STI interval. Keystrokes: To program a selectable timed interrupt subroutine, a Get instruction must be the first instruction in the first rung after the use program subroutine area statement (Figure 15.1). This designates that an STI follows. Then, you can program your subroutine. The transition time from main program to STI and return is 100µs.

15-1

Page 176

Chapter 15 Selectable Timed Interrupt

Figure 15.1 Memory Organization Data Table

User Program

Subroutine Area YYY XX G LBL XXX

010

010

00

00

Selectable Timed Interrupt Subroutine

Other Program Subroutine

RET

The Get instruction serves as a time base (xxx) for the STI. The Get instruction can have any data table address (yyy) except a processor work area. It must be used solely to designate the time base of the STI. The available time bases are: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, and 50 milliseconds. Your program, through the use of a Get/Put instruction (see chapter 9) can change the time base of the selectable timed interrupt. The subroutine must end with an unconditional return instruction. The Label instruction is optional and is only used when the main program wants to call the subroutine based on other conditions rather than selected time periods. If the subroutine timed interrupt is used as a direct subroutine with a Label instruction, you can have seven subroutines plus the STI. If the subroutine is not used as a direct subroutine, you can have eight subroutines plus the STI.

Operational Overview

15-2

Service time (Figure 15.2b) is factory set at approximately 2/3 of the timed interrupt period. Subroutine execution time plus program transition time (Figure 15.2c) should not exceed the maximum allowable service time (Figure 15.2b). When the program transition time plus subroutine execution time does not exceed service time, there is sufficient time for the processor to scan the subroutine.

Page 177

Chapter 15 Selectable Timed Interrupt

Figure 15.2 Time Relationship of Subroutine Execution Time versus Service Time 0

Figure 15.2a

Time Base

Figure 15.2b

Service Time

Figure 15.2c

Subroutine Execution Time Less Than Service Time

Figure 15.2d

Subroutine Execution Time Greater Than Service Time

Figure 15.2e

Subroutine Execution Time Greater Than STI Period

1

2

3

4

5

6

Selectable timed interrupts are executed at every time period once they are enabled, including the I/O scan. During the program, the program is interrupted while the STI subroutine is executed. The program returns to the point of interrupt and continues execution just as if nothing has happened. However, during an I/O scan, a block transfer may be requested by a module. In this case, the STI is not executed until the block transfer is completed. In addition, the STI is disabled during an insert/remove or a mode of operation change. Should the subroutine execution time plus program transition time exceed service time (Figure 15.2d), the selectable timed interrupt is no longer accurate. Two things happen: The STI too long bit (02702) is set on. This bit is available for your use and can be used to initiate annunciators or other status indicators. The bit functions similar to a latch instruction and must be reset with an Unlatch instruction. The processor completely executes the subroutine. It waits one complete STI period before executing the subroutine again (Figure 15.2d and 15.2e).

Chapter Summary

In this chapter, we showed you how to execute subroutines at timed intervals. The next chapter shows you how to edit instructions in your program. 15-3

Page 178

Chapter

16

Program Editing

Chapter Objectives

This chapter describes how to edit instructions in your program: rules for editing instructions editing relay-type instructions editing other instructions

Rules for Editing Instructions

This section outlines the rules for editing instructions: editing searching clearing memory Editing Changes to an existing program can be made through a variety of editing functions (Table 16.A). Instructions and rungs can be added or deleted; addresses, data, and bits can be changed. Table 16.A Editing Functions 1

Function

Key Sequence

Mode

[INSERT] (Instruction) (address) or [INSERT][←] (Instruction) (Address)

Program

Removing a condition instruction

[REMOVE] (instruction)

Program

Position the cursor on the instruction to be removed and press the key sequence.

Inserting a rung

[INSERT] [RUNG]

Program

Position the cursor on any instruction in the preceding rung and press the key sequence. Enter instructions and complete the rung.

Removing a rung

[REMOVE] [RUNG]

Program

Position the cursor anywhere on the rung to be removed and press the key sequence.

Inserting a condition instruction

Description Position the cursor on the instruction that will precede the instruction to be inserted. Then press key sequence. 2 Position the cursor on the instruction that will precede the instruction to be inserted. Then press key sequence. 2

IMPORTANT: Only addresses corresponding to output energize latch and unlatch instructions are cleared to zero.

16-1

Page 179

Chapter 16 Program Editing

Function

Key Sequence

Mode

Description

Change data of a word or block instruction

[INSERT] (Data)

Program

Position the cursor on the word or block instruction whose data is to be changed. Press the key sequence.

Change the address of a word or block instruction

[INSERT] (First Digit) [←] (Address)

Program

Position the cursor on a word or block instruction with data and press [INSERT]. Enter the first digit of the first data value of the instruction. Then use the [←] and [→] key as needed to cursor up to the word address. Enter the appropriate digits of the word address.

Online programming

[SEARCH] [5] [2]

Replace an instruction or Change address of an instruction without data

[Instruction] (Address)

Program

Position the cursor on the instruction to be replaced or whose address is to be changed. Press the desired instruction key (or key sequence) and the required address(es).

[SEARCH] [5] [1] (Data) [RECORD] [CANCEL COMMAND]

Run/Program

Position the cursor on the word or block instruction whose data is to be changed. Press the key sequence. You can use the cursor keys.

[CANCEL COMMAND]

Program Run/Program

Online Data Change

All editing functions 1 2

Initiates online programming.

Press [RECORD] to enter the new data into memory. To terminate online data change. Aborts the operation at the current cursor position.

These functions can also be used during online programming. When bit address exceeds 5 digits, press the [EXPAND ADDR] key before entering address and enter a leading zero if necessary.

Important: If the memory write protect is active, you can change only data table values between word addresses 010 and 177. Inserting an Instruction Only non-output instructions can be inserted in a rung. There are ways of doing this: First instruction of an existing rung First instruction of another rung Another location in the rung. Keystrokes: You insert an instruction using either of the two ways by performing the following steps. First Instruction of an Existing Rung

16-2

1.

Position the cursor of the first instruction of the existing rung.

2.

Press [INSERT][←].

3.

Insert <instruction>.

4.

Insert <address>.

Page 180

Chapter 16 Program Editing

First Instruction at the Beginning of Another Rung. 1.

Position the cursor on the previous rung’s output instruction.

2.

Press [INSERT].

3.

Insert <instruction>.

4.

Insert <address>.

If the cursor is on the END statement, the instruction is inserted before the END statement or subroutine area. Another Location in the Rung 1.

Position the cursor on the instruction immediately preceding your selected location.

2.

Press the key sequence [INSERT].

3.

Press <instruction>.

4.

Press <address>.

The new instruction is inserted after the cursor’s present position. You can enter bit addresses of 6 or 7 digits provided the data table is expanded to a 4- or 5-digit word address and you press [EXPAND ADDR] before you enter the address. If, at any time, the memory is full, a MEMORY FULL message is displayed and you cannot enter more instructions. Removing an Instruction Only non-output instructions can be removed from a rung. Output instructions can be removed only be removing the complete rung. Keystrokes: To remove an instruction, perform the following steps. 1.

Place the cursor on the instruction you are going to remove.

2.

Press [REMOVE] <instruction>.

Bit values and data of word instructions are not cleared. The input image table bits are rewritten during the next I/O scan. If you press the wrong instruction, and INSTRUCTIONS DO NOT MATCH message is displayed.

16-3