The text of a manual · part 12 of 14
Mini-PLC-2 Programmable Controller Programming and Operations Manual, pages 111 to 120
Pages 111 to 120 of 132
The original document is the PDF (13 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-LN2 and Allen-Bradley 1772-LN3
Page 111
Page 11-9
BUFFERING DATA
The purpose of Block Transfer data buffering is to allow the data to be validated before it can be 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 Read bit (or Write bit) is set in the Input Image Table byte 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 group of words transferred, while others set a data-valid diagnostic bit in each word. Refer to the respective User’s Manual for the Block Transfer module to determine the correct usage of the diag- nostic and/or data valid bit(s).
One technique for bufferring data is to store the transferred data in a temporary storage location. If the data is valid, it is immediately transferred to another storage location in the Data Table where it can be used. If invalid, itis not transferred but written over in the next transfer. Another technique uses only one Storage location. This technique prevents invalid data from being operated upon by pre- conditioning the rungs that would transfer data out of storage one word at a time.
Data can be moved from storage word-by- word using GET/PUT transfers. Generally, this method is used when one diagnostic bit is contained in each word. Diagnostic bits are examined as conditions for enabling the GET/PUT transfers.
The example in Figure 11-9 shows the memory map and ladder diagram rungs for buffering 3 words of data that are read from the Block
Transfer module. Two storage locations are used. The data is read and buffered in the following sequence:
1. When Rung 3 goes TRUE, bit 014/07 (the Read bit) will be turned ON and Block Transfer will be requested. This latches ON storage bit 010/00 in Rung 4.
2. Block Transfer will be requested during the program scan. The transfer will be performed during an interruption of the next I/O scan. Data from the module will be loaded into words 050,-052,. When Block Transfer is com- plete, the Read 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 will be TRUE because bit 010/00 is still latched ON and bit 114/07 is ON because Block Transfer was performed. This will turn bit 010/02 ON. In Rung 2, bit 010/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 will be ON and the data will be transferred from word 050, to 150,. In rungs 5 and 6, the data in words 051, and 052, will be transferred to words 151, and 152, if the diagnostic bits are ON.
11.3 ONE-SHOT
The one-shot programming technique is used for certain applications to set a bit ON for one scan only. There are two types of one-shots that can be programmed:
e Leading Edge e Trailing Edge
11.3.1 Leading Edge One-Shot
A leading edge one-shot is used to set a bit ON for one scan when its input condition has made a FALSE-to-TRUE transition. The FALSE-to-TRUE transition represents the leading edge of the input pulse. The programming for a leading edge one-shot is shown in Figure 11-10.
Page 112
Page 11-10 a,
BLOCK LENGTH
| 1 | 0 CODE 014 DATA IN THE BUFFER FILE, ; # 050-052, WILL BE MOVED TO 150-152 WHEN: A. DONE BIT 114/07 | 1 | 4 | 0 030 IS SET (VALID TRANSFER AND) B. DIAGNOSTIC BIT IS TRUE 050 FOR EACH WORD TO BE MOVED IN RUNGS 5-7 BLOCK TRANSFER DATA (BUFFER) (VALID DATA) os2 4 | by R R 11] 0] 114 - + - DONE BIT Dep [2 | | 150 | BLOCK TRANSFER DATA (VALID) | <<! 152 010 114 010 RUNG? HY Ly | 4 00 «07 02 010 RUNG 2 {U)4 00 111. 030 = 130 014 RUNG3 -} +4 G+-4 GL (4 11 140 050 07 014 010 RUNG 4 LY | 4.4 07 00 010 050 150 RUNG5 +4 -4 E46} {PUT} 02 111 111 010 051 151 RUNG6 HY -4 G| PUT) 02 222 222 010 052 152 RUNG7 + +4 Gr {PUT} - 02 333 333
DIANOSTIC BIT
FIGURE 11-9, Buffering Data
Page 113
Page 11-11
LEADING EDGE
BIT 112/04 on ------ t I
OFF ___J BIT 253/00 ON r---
<
OFF __ ONE SCAN
ONE-SHOT
12 O11 253. |« - STORAGE rt b4/|, t BIT
04 «14 00
253 011 Hk lt
00 14
253 011 HF 1, {U} - ~
04 14
253
L ( ONE-SHOT a 00 4 ourpuT, +----- INPUT PULSE
FIGURE 11-10, Leading Edge One-Shot
When bit 112/04 makes a FALSE-to-TRUE transition, the one-shot bit (bit 053/00) is set ON for one scan. The length of time bit 112/04 remains ON does not affect the one-shot bit due to the next two rungs. Bit 011/14 will be latched ON when bit 112/04 is ON or bit 011/14 will be unlatched when bit 112/04 is OFF. During the next scan, either set of conditions will prevent bit 053/00 from being set ON. The one-shot bit is set ON for another scan only when bit. 112/04 makes another FALSE-to-TRUE transition.
11.3.2 Trailing Edge One-Shot
A trailing edge one-shot is used to set a bit ON for one scan when its input condition has made a TRUE-to-FALSE transition. The TRUE- to-FALSE transition represents the trailing edge of the input pulse. Programming for a trailing edge one-shot is shown in Figure 11-11.
When bit 112/04 goes TRUE, bit 011/14 is latched ON. As soon as bit 112/04 makes a
TRUE-to-FALSE transition, the one-shot bit (bit 053/00) is set ON and bit 011/14 is un- latched. Bit 053/00 will remain ON for only one scan. The input bit 112/04 must go TRUE and FALSE to set the one-shot bit ON for another scan.
11.4 PROGRAMMING 0.01-SECOND TIMERS
11.4.1 Introduction
The Bulletin 1772 Mini-PLC-2 programmable controller permits the user to enter On Delay Timer (TON), Off Delay Timer (TOF) and Retentive Timer (RTO) Instructions with a 0.01-second time base. These are also referred to as 10 millisecond (10-msec) timers.
Timers with a 10-msec time base provide the user with greater timing resolution and ac- curacy than is possible with a0.1-second time base. Ten-msec timers are used when time delays from 0.02 to 9.99 seconds are required.
Page 114
Page 11-12
112 011 | {L)} - 04 14 ONE-SHOT 112 011 253 |~ - STORAGE tr /t 4 |} { } - BIT 04 «14 00 253 011 rt {U} - 00 14 203 ONE-SHOT L ni - - 00 { *> output
TRAILING EDGE
BIT 112/04 ON a 1 ! OFF ___j_____ INPUT PULSE BIT 253/00 ON OFF ONESCAN L__
FIGURE 11-11, Trailing Edge One-Shot
11.4.2 Time Base Selection When a timer Instruction is entered into a program, the programmer must specify:
e Timer word address e Time base e Preset value e Accumulated value (for RTO only)
Note that the user selection of preset value and time base are closely related. The Processor executes the time-delay functions by in- crementing the timer accumulated value one unit for each time base unit that elapses. In other words, the preset value represents a specific number of increments of the time base.
Note, however that the preset value is not an absolute length of time. For example, if the present value is 010, the time delay will be:
e 10 seconds if a 1.0-second time base is entered e 1.0 second if a 0.1-second time base is entered e 0.10second if a0.01-second (10-msec) time base is entered
The smaller the time base, the larger the preset value must be to obtain the same time delay. To obtain a 5-second time delay, the program could contain:
e 1.0-second time base and preset = 005 e 0.1-second time base and preset = 050 0.01-second time base and preset = 500 11.4.3 Timer Accuracy
Given any preset value, a Mini-PLC-2 con- troller timer is accurate to within one interval of its time base. Specifically, the timed interval does not exceed the preset interval, but it may be as much as 1 time-base unit shorter than the preset. These examples illustrate this accuracy:
e TON: Time base 1.0-second; preset value 100. This time interval will be greater than 99 seconds, but less than or equal to 100 seconds as given in the equation below.
99 seconds < TON timed out < 100 seconds
Page 115
Page 11-13
¢ TON: Time base 0.1-second; preset value 100. This time interval will be greater than 9.9 seconds, but less than or equal to 10.0 seconds as given in the equation below.
9.9 seconds < TON timed out < 10.0 seconds e TON: Time base 10-msec; preset value 100. This time interval will be greater than 0.99 seconds, but less than or equal to 1.00 second as given in the equation below.
0.99 seconds < TON timed out < 1.00 second
Note that special programming techniques are required to use the 10-msec timer in a program. These techniques are explained in Scan Time and Program Execution, 11.4.6 and 11.4.7 below.
Programmed timers examine internal timing pulses of the Mini-Processor. (Refer to figure 11-12.) A change in the state of this internal clock causes the timer to increment its accumulated value. Note, however that the timing pulses are continuous and are only examined by the Mini-Processor when a timer Instruction is being executed in the program. As figure 11-12 shows, when the Mini-Pro- cessor initially examines this internal clock, the clock may have just changed state or may be just about to change state. This variable makes it possible for the inacuracy of up to 1 time-base increment.
Note that these timing accuracies refer only to internal Mini-Processor operation. That is, these intervals refer to the length of time which occurs between the moment that a timer is initialized (bit 17 set) and the moment that a timed interval is complete (bit 15 set). Other factors add to this timer inaccuracy. Chief among these are the response time of the actual hardware devices controlled and monitored by the Mini-PLC-2 controller. (Refer to Hardware and Processor Considera- tions, 11.4.5 below.)
The user is urged not to overspecify timing accuracy. In many applications timing within 0.1 second will provide accuracy comparable to, or better than, typical electomechanical timing relays. In general, these rules may be applied:
e For delays of 99 to 999 seconds, use the 1.0-second time base e For delays of 2.00 to 99.9 seconds, use a 0.1-second time base e For delays of 0.02 to 2.00 seconds, use the 10-msec time base
When time delays are incorporated in a pro- gram to provide a warmup or initializing period, or to prevent the simultaneous application of power to high-current devices, inaccuracies on the order of 50 to 250 msec are probably insignificant. The 1.0- or 0.1-second time bases are more than adequate for these uses. Applications for the 10-msec timer are dis- cussed below.
Example: [TON], Preset = 003; any time base, >! One unit of time base
JUL LL
! ' ! Internal 4} to '
Clock | Pulses od W LI l
1 i}
1
I Enabled ! Bit17 0
H
H Timed H f Bit15 09, - - |
! ! ! T=3 i}
(* - Begin Timing - 4 !
-
!
' 2<T<3
Figure 11-12, Timing Diagram
Page 116
Page 11-14
11.4.4 Typical Applications
In general, 10-msec timers are used for these functions:
e Monitor events on a high-speed assembly or transfer line, such as that used in canning and bottling machines e Generate short-duration pulses for accurate positioning control
For example, on a bottling or canning line, photoelectric sensors or electromagnetic proximity switches can be used to detect the movement of bottles. Each time a bottle passes a detector, an On Delay or Off Delay timer can be started. The next bottle down the line will turn the sensor on (or off), thereby resetting the timer. Once the second bottle is past the sensor, the timer is started again. If the bottles are moving too slowly, or if a bottle is missing, the timer will time out. The timed bit in the Data Table of the Mini-PLC-2 controller can be programmed to set off an alarm, or to stop the machine until the problem is corrected.
With the speeds encountered on a typical high-speed bottling machine, a timer with a 0.1-second time base would probably be too slow for this application. By computing the minimum bottle travel speed, the maximum time between bottles could be determined. The time in 10-msec increments could then be entered as the timer preset.
As another typical example, 10-msec timers could also be used to operate sorting mechan-isms for high speed machines. Two methods could be used.
In the first method, the sort mechanism could be energized, for example, 60 msec after a REJECT is sensed by a particular sensor.
In the second method, the REJECT sense switch could immediately apply a 40-msec pulse to the sort mechanism. In this case, the pulse is just long enough for the mechanism to pull only one rejected bottle off the line.
Yet another example for the generating of short-duration pulses can also be found in machine tools and similar applications re- quiring accurate positioning control. Typically, 10-msec timers are used to generate one short duration pulse, or a series of pulses, when a limit switch or proximity switch detects end of travel, depth reached, or similar data. Detection that machining depth has been reached could, for example, generate a 130-msec pulse to the motor reverse circuit, thus plugging or braking the spindle with great accuracy.
Programmable control offers additional ad- vantages in these applications. For example, consider a bottling machine capable of filling and capping 12-ounce and 16-ounce bottles. The larger bottles may move more slowly, or the spacing between bottles may be different. Detection of 16-ounce bottles could cause the Mini-PLC-2 Processor to GET different timer preset values and PUT them into monitoring and sorting timers such as those discussed above.
Changing the timer presets in this manner also enables the programmer to fine-tune the system without physically adjusting the locations of detection devices:
11.4.5 Hardware and Processor Considerations
When considering use of the 10-msec timer, the user must consider other timing factors, both within the programmable controller and in the hardware devices:
e Every input device requires a length of time to change state. Photoelectric devices and electromagnetic proximity switches typi- cally operate in the range of 3 to 50 msec. Mechanical switches and magnetic control relays can require longer times for opera- tion.
e Some Input Modules may provide a slight delay resulting from the input filter time constant (typically 10-25 msec).
e The execution of each program Instruction requires a certain length of time. Instruction execution times are discussed below in relation to program scan time computation.
e Scan time (I/O scan + program scan) de- pends on the number and type of Instruc- tions, as discussed below. Incorporation of Immediate Input and Immediate Output Instructions can compensate for the length of scan time.
Page 117
Page 11-15
¢ DC Output Modules typically respond in 1 to 5 msec. AC Output Modules respond in3 to 10 msec, depending on the instantaneous value of the AC wave when the turn-on signal is applied.
e User output devices may take 50 to 100 msec or longer to operate after current is applied. Inductive loads, or devices with substantial surge suppression circuitry, may also have longer response time.
Each of the items discussed above will have an impact on the actual time delay obtained from a programmable timer. Selection of fast- response indput devices is the responsibility of the user, and is beyond the scope of this document. For selection of suitable I/O Modules contact your local Allen-Bradley representative for further assistance.
The remainder of this section will discuss programming techniques which the program- mer must use to effectively program the 10- msec timer. The required programming is based on 2 concepts:
e Scan time
® Sequential program scan
11.4.6 Scan Time
The Mini-PLC-2 Processor performs an I/O scan and then a program scan, in sequence. Scan time is the sum of the times required for both these scans. (Note that the Processor does not scan unused memory, nor does it scan that portion of the memory used to store Messages.)
During an I/O scan, the Processor examines Output Image Table bits, and updates or corrects the ON/OFF signals applied to the Output Modules. It also examines the ON/OFF signals from the Input Modules and updates the ON/OFF status of the corresponding Input Image Table bits.
During a program scan, the Processor scans each instruction in the Program, one atatime. It executes Examine and Branching Instruc- tions, but it executes Ouptut Instructions only if the rung is TRUE. The sequential nature of this scan is discussed further below.
Scan time cannot be specified exactly for all processors because each user program is different. The length of the scan time depends on both the number and the type of Instruc- tions the program contains. (Actual scan time computation is discussed below.) For pur- poses of discussion, scan time is generally assumed to be about 25 msec, though in practice it will range from about 15 msec to 50 msec, or more in certain extreme cases.
11.4.7 Program Execution
The second consideration for 10-msec timer programming is the sequential nature of the program scan. The Processor executes one program Instruction at atime. After it executes an Instruction, it cannot examine that Instruction again until the next scan of memory. With respect to timer Instructions, particularly, the Processor cannot increment the accumulated value except when it is executing that In- struction.
Furthermore, the only states of any memory bits that affect the execution of any single Instruction are the states those bits have at the instant the Processor executes the Instruction. If a bit changes state after the Instruction is executed, the change of state will not affect the instruction until it is executed the next time.
For example, suppose one program Instruction is Examine On 110/13. If the device is open, the Processor will detect an OFF signal from the Input Module during the I/O scan, and will clear (reset to “O”) the corresponding Input Image Table bit. After the I/O scan, the program scan begins.
Suppose, in this case, that the input device wired to a terminal at address 110/13 closes when the program scan begins. The corres- ponding Image Table bit will remain “0” (device is Open) until the next I/O scan after the current program scan is finished, or until the Processor executes an Immediate Input In- struction addressed to word 110.
The Processor can also update a timer only at the instant it is executing that timer instruction. Remember that an integral timing clock (see Section 11.4.3) puts out pulses for the 1.0- second, 0.1-second and 10-msec timers. When 1.0-second and 0.1-second timers are used in a program, the timing pulses are always longer than the Processor scan time. No special
Page 118
Page 11-16 programming is required; these timers will not miss a timing pulse.
Timing pulses for the 10-msec time base, however, are usually shorter than the program scan time. Since the Processor can only in- crement a timer while it is executing that Instruction, the 10-msec timer could miss one or more timing pulses on each program scan. The solution is to instruct the Processor to execute the timer Instruction often enough that it will not miss a pulse.
11.4.8 Programming Compensation
In order to compensate for the length of the scan time and to assure accurate timing, 10- msec timer programming must be repeated several places in the program.
Atypical program using the total memory can nominally be assumed to have a scan time of less than 30 msec. (See Section 11.4.9.) In such a program, enter the sametimer rung at3 different places in the program: once near the beginning of the program, once near the middle, and once near the end. The Processor will update the timer accumulated value each time it scans that timer Instruction. Refer to Figure 11-13 and note the following:
e The rung must be identical each time it is used: the same Examine Instructions to condition the rung, the same timer word address, the same time base, and the same preset value.
e Use this technique only for 0.01-second timers. (The program scan is fast enough to assure accurate operation of the 1.0-second and 0.1-second timers with only one timer rung per program.)
Multiple entry of the timer rung will help to assure that the accuracy of the timer accumulated value is within the accuracy limits discussed above. Additional programming tech- niques can help to assure that output devices controlled by the timer are energized or de- energized after as precise a time delay as possible. The programmer may want to in- clude:
e Multiple entries of rungs which examine the timed bit of the timer to condition an Output Energize Instruction.
© Immediate Input Instructions to help assure that the timer is enabled as quickly as possible after the external event occurs.
e Immediate Output Instructions to help assure that the output device is energized/ de-energized as quickly as possible after the Mini-Processor sets the Output Image Table bit to “1” or clears it to “0”.
Start of program scan
Same 0.01-sec. timer rungs
Scan time = 25 msec. (typical!)
0.01-sec.
a timer rungs
Same 0.01-sec. timer rungs
Figure 11-13, Typical Timing Diagram for 0.01-Second Timer
Page 119
Page 11-17
Example 10-msec timer rungs are shown in Figure 11-14. In Rung No. 1, the Immediate Input Instruction precedes the Examine In- struction addressed to a bit in Input Image Table word 110. When used near the middle or end of a program, the Immediate Input In- struction helps to assure that the Processor will be executing the Instruction based on accurate data.
In Rung No. 2, the Output Energize In- struction conditioned by the timer bit should also be repeated in the program. When used near the beginning or middle of the program, the Immediate Output Instruction addressed to Output Image Table word 014 will help to assure that the Output Module will respond quickly to timer cycling.
By repeating the timer rung and related rungs, the programmer can assure that the Proces- sor will update timer accumulated values more frequently than the timing pulses change state. As shown in Figure 11-13 repeti-tion within 8 or 9 msec will be adequate for this purpose.
11.4.9 Program Scan Time Computation
In order to evaluate programming needs, the user may wish to calculate the approximate scan time. An exact computation is not prac- tical, but a reasonable approximation can be obtained using the approximate execution times listed in Section 12, Table 12-1. Enter the 10-msec timer rungs 3 times per 1K (1024) words of program, then compute the scan time. A sample computation follows:
Assume the Processor is using a 128-word Data Table and has 1024 words of memory. If all memory words are used, the program will contain 896 Instructions. A program of this size might typically have the following dis- tribution:
e 546 Instructions x 18 usec = 9.8 msec e 306 Instructions x 28 usec = 8.6 msec e 44 Instructions x 83 usec = 3.7 msec
° Total (rounded): = 22 msec
The I/O scan time adds approximately 1.0 msec + 1 msec
Program Panel interaction requires about 3.0 msec + 3 msec Total: 26 msec
If a 10-msec timer is used in a program of this duration, the timer rung and related rungs must occur at least 3 times in the program at evenly spaced intervals. For longer programs, it may be necessary to repeat the timer in- struction and related rungs several more times to assure that timing is accurate.
110 = 110 030 a - {I }, (TON} - 05 0.01 PR 025 AC 000 030 014 flo { “1 I \ 15 05 014 B ~10T) - Repeat these rungs 3 or more places in the program. Ed When used near the beginning of the program, the (1) instruction can be omitted. BB When used near the end of the program, this rung can be omitted.
Figure 11-14, Example 0.01-Second Programming