The text of a manual ยท part 8 of 29
1772 Mini PLC-2/05 Processor (Cat. No. 1772-LS, LSP) Programming and Operations Manual, pages 71 to 80
Pages 71 to 80 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 71
Chapter 8 Timers and Counters
Retentive Timer On/Reset Retentive Timer On Purpose: The Retentive Timer On accumulates the amount of time that the preconditions of its rung are true. It controls one or more outputs (by means of other rungs) after the total accumulated time is equal to the preset time. Whenever the rung is false, the accumulated time is retained. If the outputs have been energized, they remain on. The accumulated time and energized outputs are retained if power is removed from the processor. A separate rung, containing a retentive timer reset instruction must be programmed in order to reset the accumulated time to zero and turn off the outputs. 010 00
030 RTO 1.0 PR 150 AC 000
When the rung condition becomes: True Timer begins counting time-base intervals. Bit 15 is set when AC=PR and the timer stops timing. Bit 17 is set. False Accumulated value is retained. Bit 15 - no action is taken. Bit 17 is reset. Important: The RTO instruction retains its AC value when the: Rung condition turns false. Processor changes to remote/program mode. Power outage occurs and memory backup is maintained. Retentive Timer Reset Purpose: The Retentive Timer Reset instruction resets the accumulated value and timed bit of the retentive timer to zero. This instruction is given the same word address as its corresponding RTO instruction. When the rung conditions go true, the RTR instruction resets the ac value and resets the status bits to zero. 010 00
8-4
030 RTR PR 150 AC 000
Page 72
Chapter 8 Timers and Counters
When the rung condition becomes: True RTR instruction resets the accumulated value of the RTO instruction. Bits 15 and 17 are reset. False No action is taken. Keystrokes: You enter a Retentive Timer On or a Retentive Timer Reset instruction by performing the following steps. 1.
Press -(RTO)- or -(RTR)-.
2.
Enter <address>.
Perform the following step for a Retentive Timer instruction only. 3.
Enter <time base>.
4.
Enter <preset value>.
Editing in a Completed Rung You edit a Retentive Timer On or a Retentive Timer Reset instruction by performing the following steps. 1.
Position the cursor over the Retentive Timer or Retentive Timer Reset you are going to change.
2.
Press -(RTO)-, -(RTR)-, or any other appropriate instruction type key.
3.
Enter <address>.
Important: Do not perform steps 4 and 5 for a Retentive Timer Reset instruction.
Counter Instructions
4.
Enter <time base> if appropriate.
5.
Enter <preset value>.
A counter counts the number of events that occur and stores this count in its accumulated value word. Counters can be located anywhere in the data table. The last valid counter address is 5477 (in a fully expanded data table). An event is defined as a false-to-true transition. Counter instructions have no time base.
8-5
Page 73
Chapter 8 Timers and Counters
The upper four bits in the accumulated value (AC) word are status bits: Bit 14 - Overflow/underflow bit. It is set when the AC value of the CTU instruction exceeds 999 or when the AC value of the CTD instruction falls below 000. Bit 15 - Count complete bit. it is set when the AC value > PR value. Bit 16 - Enable bit for CTD instruction. It is set when the rung condition is true. Bit 17 - Enable bit for CTU instruction. It is set when the rung condition is true. There are three types of counter instructions available with the controller: up counter down counter counter reset
Up Counter Purpose: An Up Counter instruction increments its accumulated value for each false-to-true transition of the rung condition. 010 00
030 CTU PR 150 AC 000
When the rung condition becomes: True Accumulated value increments by 1. Bit 14 is set if the AC > 999. Bit 15 is set when AC > PR. Incrementing the accumulated value continues after the preset value is reached. Bit 17 is set and stays set until the rung goes false. False Accumulated value is retained. Bit 14 - no action is taken. Bit 15 - no action is taken. Bit 17 is reset.
8-6
Page 74
Chapter 8 Timers and Counters
The Up Counter instruction retains its AC value when: You change the mode to the remote program. The rung condition turns false. A power outage occurs and memory backup is maintained. Important: Bit 14 of the accumulated value word is set when the accumulated value either overflows or underflows. when a down counter preset is 000, the underflow bit 14 will not be set when the count goes below 0.
Down Counter Purpose: The Down Counter instruction subtracts one from its accumulated value for each false to true transition of its rung conditions. A count is only added on a false to true transition, so rung conditions must go from true to false and back to true before the next count is registered. 010 00
030 CTD PR 150 AC 000
When the rung condition becomes: True Accumulated value decrements by 1. Bit 14 is set when AC < 000. Bit 15 is reset when AC < PR; counting continues. Bit 16 is set and stays set until the rung goes false. False Accumulated value is retained. Bit 14 - no action is taken. Bit 15 - no action is taken. Bit 16 is reset.
Counter Reset Purpose: The Counter Reset instruction resets the up counter down counter instructions accumulated value and status bits to 0. 010 00
030 CTR PR 150 AC 000
8-7
Page 75
Chapter 8 Timers and Counters
When the rung condition becomes: True Accumulated value of the specified counter is reset to 000. Status bits (14,15,16,17) are reset. False No action is taken. Keystrokes: You enter an Up Counter, Down Counter or Counter Reset instruction by performing the following steps. 1.
Press -(CTU)-, -(CTD)-, or -(CTR)-.
2.
Enter <address>.
Important: Do not perform steps 3 and 4 for a Counter Reset instruction. 3.
Enter <preset value>.
4.
Enter <accumulated value>.
Editing in a Completed Rung You edit an Up Counter, a Down Counter, or a Counter Reset instruction by performing the following steps. 1.
Position the cursor over the Up Counter, Down Counter or Counter Reset you want to change.
2.
Press either -(CTU)-, -(CTD)-, -(CTR)-, or any other appropriate instruction type.
3.
Enter <address>.
4.
Enter <preset value> if appropriate.
Important: Do not perform steps 4 and 5 for a Counter Reset instruction. 5.
Chapter Summary
8-8
Enter <accumulated value>.
We showed you how to use timer and counter instructions to keep track of timed intervals and counted events. The next chapter shows you how to transfer and compare data.
Page 76
Chapter
9
Data Manipulation Instructions
Chapter Objectives
In this chapter, you will read about two types of instructions used to transfer and compare data and how to use these instructions to perform operations of data that is stored in the data table. These types of instructions are: transfer instructions compare instructions
Transfer Instructions
There are two data transfer instructions. They are: get put
Get Purpose: A Get instruction accesses all 16 bits of one word location in the data table. It does not determine rung or require logic continuity. A Get also provides a time base for a selectable timed interrupt. In an STI, the Get instruction is the first instruction in the subroutine area. See chapter 15 for more information.
ATTENTION: Use the subroutine area carefully because unintended subroutine execution can cause unexpected machine operation.
Programmed in the condition area of the ladder diagram rung. It can be located at the beginning of a rung or with one or more conditions preceding it. It is always true and intensified. Get always accesses the word to which it is addressed. It displays a three hexadecimal value of lower 12 bits (bits 0-13) of the specified word. 111 130 G 11 238
040 PUT 000
9-1
Page 77
Chapter 9 Data Manipulation Instructions
Put Purpose: A Put instruction receives all 16 bits of data from the immediately preceding Get instruction and stores the data at the specified data table word location. Use with a Get instruction to form a data transfer rung. Programmed in the output side of the ladder diagram rung. This instruction can have the same address as other instructions in the program. It must be immediately preceded by a Get or a Get-Byte instruction. 111 130 G 11 238
040 PUT 000
When rung conditions become: True A Get instruction transfers data to the Put instruction. The lower 12 bits are displayed in hexadecimal beneath the Put instruction. Bits 14-17 are transferred but not displayed. False Because he Put instruction is retentive, any change in Get instruction data does not change Put instruction data. Keystrokes: You enter a Get or Put instruction by performing the following steps. 1.
Press -[G]- or -(PUT)-.
2.
Enter <address>.
Important: Do not perform step 3 for a Put instruction. 3.
Enter <data> if appropriate.
Removing a Get Instruction You remove a Get instruction by performing the following steps. 1.
Position the cursor over the Get instruction you are going to remove.
2.
Press [REMOVE] -[G]-.
Removing a Put Instruction The only way to remove a Put instruction is to remove the whole rung. See chapter 16.
9-2
Page 78
Chapter 9 Data Manipulation Instructions
Editing a Get Instruction in a Partially Completed Rung 1. Enter the next instruction. 2.
Position the cursor over the Get instruction you want to change.
3.
Press -[G]- or any other appropriate instruction type key.
4.
Enter <address>.
5.
Enter <data> if appropriate.
Editing a Get or Put Instruction in a Completed Rung 1. Position the cursor over the Get or Put instruction you want to change. 2.
Press -[G]-, -(PUT)-, or any other appropriate instruction type key.
3.
Enter <address>.
Important: Do not perform step 4 for a Put instruction. 4.
Compare Instructions
Enter <data> if appropriate.
There are three compare instructions: equal to less than limit test
Equal To Purpose: An equal to comparison is made with the Get and Equ instructions. The get value is the changing variable and is compared to the reference value of the Equ instruction for an equal to condition. When the get value equals the equ value, the comparison is true and logic continuity is established. It determines the rung condition. Compares only the lower 12 bits to the immediately preceding get instruction. 120 030 035 G = 03 YYY 100
010 02 Reference Value
When YYY = 100, GET/EQU comparison is true and 010/02 is energized.
If the rung condition becomes: True - If there is equality. False - If there is no equality. 9-3
Page 79
Chapter 9 Data Manipulation Instructions
Keystrokes: You enter an Equal To instruction by performing the following steps. 1.
Press -[=]-.
2.
Enter <address>.
3.
Enter <reference value> if appropriate.
Removing an Equal To Instruction You remove an Equal To instruction by performing the following steps. 1.
Position the cursor over the Equal To instruction you are going to remove.
2.
Press [REMOVE] -[=]-.
Editing a Completed Rung You edit an Equal To instruction by performing the following steps. 1.
Position the cursor over the Equal To instruction you are going to edit.
2.
Press -[=]- or any other appropriate instruction type key.
3.
Enter <address>.
4.
Enter <reference value> if appropriate.
Less Than Purpose: The Less Than instruction compares the data in your specified address with the data stored at another address in memory. It determines the rung condition. Compares only the lower 12 bits to the immediately preceding Get instruction. Programmed after the Get instruction in the condition side of the ladder diagram rung. 120 030 037 G < 01 YYY 654
010 02 Reference Value
When YYY < 654, GET/LES comparison is true and 010/02 is energized.
The rung condition becomes: True - If the get value is less than the reference value stored in the Less Than instruction. False - If the get value is equal to or greater than the less than value. 9-4
Page 80
Chapter 9 Data Manipulation Instructions
Keystrokes: You enter a Less Than instruction during initial programming by performing the following steps. 1.
Press -[<]-.
2.
Enter <address>.
3.
Enter <reference value>.
Removing the Less Than Instruction You remove a Less Than instruction by performing the following steps. 1.
Position the cursor over the Les Than instruction you want to remove.
2.
Press [REMOVE] -[<]-.
Editing a Completed Rung You edit a Less Than instruction by performing the following steps 1.
Position the cursor over the Less Than instruction you are going to edit.
2.
Press -[<]- or any other appropriate data comparison instruction.
3.
Enter <address>.
4.
Enter (reference value).
Limit Test Purpose: The limit test checks to see if a byte value is between two reference byte values in the limit test instruction. Programmed with a Get Byte instruction located in the condition area of the ladder diagram. Do not place compare instructions between the Get Byte and Limit Test instruction. The Get Byte and Limit Test instructions work only with octal values.
9-5