The text of a manual · part 42 of 59
Mini-PLC-2/02, 2/16, 2/17 Processor (cat. no. 1772-LZ, LZP, LX, LXP, LW, LWP) User Manual: 22 - Selectable Timer Interrupts
Pages 348 to 351 of 490, from Mini-PLC-2/02, 2/16, 2/17 Processor (cat. no. 1772-LZ, LZP, LX, LXP, LW, LWP) User Manual
The original document is the PDF (2.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-LW /LWD, Allen-Bradley 1772-LWP, Allen-Bradley 1772-LX / LXP and Allen-Bradley 1772-LZP
Page 348
Chapter
22
Selectable Timed Interrupt
Chapter Objectives
This chapter describes a method to execute subroutines at timed intervals. This method is called selectable timed interrupt (STI).
Introduction
A selectable timed interrupt is a special subroutine that can be programmed into the subroutine area and can be executed at timed intervals. General programming facts are: The first instruction in the first rung of the subroutine area must be a Get instruction. This identifies it as an STI. The Get instruction must be used solely for the purpose of designating the time period of the STI. The 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 22.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.
22-1
Page 349
Chapter 22 Selectable Timed Interrupt
Figure 22.1 Sample Program Rungs Sample Program 047
110
15
01
RUNG 1
027
RUNG 2
02 RUNG 3 User Program
110
RUNG 4
00 110
RUNG 5
00 110
RUNG 6
00
047 RTO 1 .01 PR 100 AC 000 010 L 07
2
057 CTU PR 999 AC 000
3
047 RTO 4 PR 100 AC 000 057 CTR 5 PR 999 AC 000 027 U 6 02
Subroutine Area 110 047 G 001 15
010 00
110
RUNG 7
00
01 RUNG 8
Selectable Timed Interrupt Subroutine
047
110
15
01
010
RUNG 9
RUNG 10
057 CTU PR 999 AC 000 057 CTU PR 999 AC 000 RET
7
8
9
10
ATTENTION: The Get instruction in the above example causes the subroutine to be scanned and the output to come on.
22-2
Page 350
Chapter 22 Selectable Timed Interrupt
The processor scans the user program (rungs 1-6) until it reaches the subroutine area. The processor then identifies the subroutine area as having an STI if: 1.
The STI subroutine begins in the first rung of the subroutine area
2.
The first instruction of the STI rung is a Get instruction
ATTENTION: The Get instruction must be used solely for the purpose of designating the time period of the STI. STI subroutine execution time should be limited to approximately 2/3 of the STI interval.
Selectable Timed Interrupt
The transition time from main program to STI and return is 50 microseconds. The Get instruction must be used solely as the STI time base and can have any data table address (yyy) except a processor work area. Available time bases (xxx) are 1-999 milliseconds. Your program, through the use of a Get/Put instruction (see chapter 12) can be used to change the time base of the selectable timed interrupt. The STI subroutine must end with an unconditional Return instruction (rung 10 of Figure 22.1). The function is disabled if you enter zero as the time base in the Get 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. The STI is executed every time period once it has been enabled during the I/O scan. The program, or I/O scan, is interrupted when the STI subroutine is executed. The program returns to the point of interruption and continues execution just as if nothing has happened. However, during an I/O scan, if a block transfer is in process, 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.
22-3
Page 351
Chapter 22 Selectable Timed Interrupt
Operational Overview
Service time (Figure 22.2b) is factory set at approximately 2/3 of the timed interrupt period. Your subroutine execution time plus program transition time (Figure 22.2c) should not exceed the maximum allowable service time (Figure 22.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. Figure 22.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
Should the subroutine execution time plus program transition time exceed service time (Figure 22.2d), the selectable timed interrupt is no longer accurate. Two things happen: The STI too long bit (02702) is set. 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 full STI period before executing the subroutine again (Figures 22.2d and 22.2e).
22-4