The text of a manual · part 5 of 14
Mini-PLC-2 Programmable Controller Programming and Operations Manual, pages 41 to 50
Pages 41 to 50 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 41
Page 4-11
TABLE 4-1, Timer Instructions
Note: The Timer word address, XXX, is assigned to the timer Accumulated area of the Data Table.
The time base, TB, is user-selectable and can be 1.0, 0.1 or 0.01 second. Preset values YYY and Accumulated values ZZZ can vary from 000 to 999.
KEYTOP SYMBOL NS TR LON DISPLAY DESCRIPTION -(TON)- TIMER ON DELAY XXX When the rung is TRUE, the timer begins -(TON)- to increment the Accumulated Value at a TB rate specified by the time base. PR YYY . . AC Z27ZZ When the rung is FALSE, the timer resets the Accumulated Value to 000. -(TOF)- TIMER OFF DELAY XXX When the rung is FALSE, the timer begins -(TOF)- to increment the Accumulated Value. PR vYy When the rung is TRUE, the timer resets AC 222 the Accumulated Value to 000. -(RTO)- RETENTIVE TIMER XXX When the rung is TRUE, the timer begins -(RTO)- to increment the Accumulated Value. TB When FALSE, the Accumulated Value is PR YYY retained. AC 222 It is reset only by the RTR instruction. -(RTR)- RETENTIVE TIMER XXX XXX, Word address of the retentive RESET -(RTR)- timer it is resetting. PR VY | yyy, ZZZ, Preset and A lated AC 22Z ', Preset and Accumulate
Values are automatically entered by the Industrial Terminal.
When the rung is TRUE, the Accumulated Value and status bit are reset to zero.
Page 42
Page 4-12
TABLE 4-2, Counter Instructions
Note: The Counter word address, XXX, is assigned to the counter Accumulated areas of the Data Table. Preset values YYY and Accumulated values ZZZ can vary from 000-999. KEYTOP SYMBOL INSTRUCTION DISPLAY DESCRIPTION -(CTU)- UP COUNTER XXX Each time the rung goes TRUE, the -(CTU)- Accumulated Value is incremented one PR YYY count. The counter will continue AC ZZZ counting after the Preset Value is reached. The Accumulated Value can be reset by the CTR instruction. The Accumulated Value “Overflow” bit is bit 14. -(CTR)- COUNTER RESET XXX XXX - Word address of the CTU it is -(CTR)- resetting. AG ans Preset and Accumulated Values are automatically entered by the Industrial Terminal. When the rung is TRUE, the CTU Accumulated Value and status bits are reset to 000. -(CTD)- DOWN COUNTER XXX Each time the rung goes TRUE, the -(CTD)- Accumulated Value is decreased one PR YYY count. AC 222 The Accumulated Value “Underflow” bit is bit 14. The Enable bit is bit 16.
Page 43
Page 5-1
Section 5 DATA MANIPULATION INSTRUCTIONS
5.0 GENERAL
The Data Manipulation instructions are used to transfer or compare data that is stored in Data Table words and bytes. There are six Data Manipulation instructions:
e GET e PUT e LES e EQU
GET BYTE e LIMIT TEST
The GET and PUT instructions are used to- gether to transfer 16 bits of data from one word location in the Data Table to another word location. Data can be in the form of 3- digit Binary Coded Decimal numbers.
The LES and EQU instructions compare data such as 3-digit numberic values in BCD for- mat using the first 12 bits of a Data Table word (Figure 5-1). This 3-digit value can be a decimal number ranging from 000 to 999.
The GET BYTE and LIMIT TEST instructions compare 3-digit values in octal format using eight bits (one byte) of a Data Table word
(Figure 5-2). This 3-digit value is an octal number ranging from 000, to 377,. Note that two 3-digit values can be stored in a word: one in the upper byte (bits 10-17) and one in the lower byte (bits 00-07).
A Data Manipulation instruction can address any word in the Data Table excluding the Processor Work Areas.
ONE BYTE (8 BITS)
/~ / \ ho !
} 21 go0!a2 9: 90192 91 90 1 1 1 0 1 1 1 1 \ iN ~y /\N =v, ‘
31 5 | 7, 1
FIGURE 5-2, Octal Representation
5.1 DATA TRANSFER INSTRUCTIONS
There are two Data Transfer instructions. They are:
© GET -[G]- © PUT -(PUT)-
A
LOWER 12 BITS, - - - - - - >} !
1 1 2° 2? 2! 2°, 23 2? 2° 2°!e - pL ACE VALUE OF BITS*
23 22 21 20 TPopofoy of oft yo} of tts} oft} of ol twits taBle WORD Y t { pooo2 FB ' MOST ! MIDDLE ! LEAST | BITS 14-17 | SIGNIFICANT!, -DIGIT_~ - s!: SIGNIFICANT! NOT USED DIGIT DIGIT FOR BCD VALUE BUT ARE ACCESSED BY THE GET INSTRUCTION.
EXPONENTIAL FORM: 29=1,2'=2,22=4,23=8
FIGURE 5-1, BCD Word Format
Page 44
Page 5-2
5.1.1 GET Instruction
GET instructions -[G]- are programmed in the condition area of the ladder diagram rung.
When the rung containing the GET/PUT in- | structions goes TRUE, the data (16 bits) in the word address of the GET instruction is duplicated and transferred to the word address of the PUT instruction. (Figure 5-3).
If the word addressed by a GET instruction already contains data, the lower 12 bits of the data are displayed automatically beneath the instruction after the word address is entered. Entry of new data such as a BCD value writes over the data previously stored in the ad- dressed word.
Although each Data Table word can store data such as one BCD value, the word address can be assigned to more than one GET instruction in the same program. This allows the program to perform several different functions with the same data.
The GET instruction is NOT a “condition” that determines rung logic continuity. When the Processor is in the RUN or TEST mode, the GET instruction is always intensified regardless of rung logic continuity. This does not mean that data transfer will occur. Data transfer occurs only when the rung is TRUE.
The GET instruction can be programmed either at the beginning of arung or with one or more Condition instructions preceding it. Condition instructions, however, should not be programmed after a GET instruction. When one or more Condition instructions precede the GET instruction, they determine whether the rung is TRUE or FALSE. Parallel branches of GET instructions cannot be programmed unless they are paired with a LES or EQU instruction.
5.1.2 PUT Instruction
The PUT instruction (PUT) is an output in- struction. It receives 16 bits of data from its corresonding GET instruction and stores the data at its address as shown in Figure 5-3. A PUT instruction can have the same address as other instructions in the program. For ex- ample, a PUT instruction having the same address as a counter Preset will change the counter Preset value to that transferred from the GET instruction. See Figure 5-4.
The lower 12 bits of transferred data are displayed in BCD beneath the PUT instruction.
OPTIONAL CONDITION
111 130 r - GI 11 238
040 (PUT 238
FIGURE 5-3, GET and PUT Instructions
OPTIONAL CONDITION
111. 130 + 46
140 {PUT} - 11 238
111
238
040 {CTU) - | 12
AC 047 PR 238
NOTE: THE PRESET OF THE COUNTER AT ADDRESS 040
IS AT ADDRESS 140.
FIGURE 5-4, Changing a Counter Preset
Page 45
Page 5-3
Bits 14-17 are not displayed but are trans- ferred. While the rung is TRUE, any change in the data of the GET instruction also changes the data of the PUT instruction. However, the PUT instruction is retentive, which means that while the rung is FALSE, any change in the data of the GET instruction does not change the data of the PUT instruction. Also, during a power loss, the data is retained.
5.2 DATA COMPARISON INSTRUCTIONS The Data Comparison instructions are:
e LESS THAN -[<]- e EQUAL TO -[=]-
¢ GET BYTE -[B]- e LIMIT TEST -[L]-
Data Comparison operations differ from Data Transfer operations because Data Table values are not transferred. Instead, the values at different word locations are compared.
Data Comparison instructions operate with either BCD values or octal values. With the LES and EQU instructions, only 12 bits of a word (the BCD values) are compared. Bits 14-17 are not compared. With the GET BYTE and LIMIT TEST instructions, 8 bits (one byte) of a word are compared.
5.2.1 LES and EQU Instructions
The LES (less than) and EQU (equal to) instructions, [<] and [=] are used with the GET instruction to perform data comparisons. They compare BCD values and are pro- grammed in the condition area of the ladder diagram rung.
A GET/LES or GET/EQU pair of instructions forms a single condition for logic continuity. Alone or with other conditions, each pair can be used to energize an output device or other output instruction. In all cases, the GET instruction must be programmed before the LES or EQU instruction. If other conditions are also programmed, they should be entered before the GET instruction or after the LES or EQU instruction.
Data comparisons are made by comparing a changing BCD value to a reference BCD value. The reference value need not be fixed. The following types of data comparisons of BCD values can be made:
e Less than e Greater than
Equal! to
Less than or equal to
Greater than or equal to
LESS THAN, A less-than comparison is made with the GET/LES pair of instructions. The BCD value of the GET instruction is the changing value. It is compared to the BCD value of the LES instruction which is the reference value (Figure 5-5). When the GET value is less than the LES value, the compari-sonis TRUE and logic continuity is established.
GREATER THAN, A greater-than compari- son is also made with the GET/LES pair of instructions. This time the GET instruction BCD value is the reference and the LES instruction BCD value is the changing value.
OPTIONAL CONDITION
120 030 037 t - | G4 <r
01 YYY 654 ~~
010 { \
00
REFERENCE VALUE
WHEN YYY < 654, GET/LES COMPARISON IS TRUE AND 010/00 IS ENERGIZED
FIGURE 5-5, LESS THAN Comparison
Page 46
Page 5-4
The LES value is compared to the GET value for a greater-than condition (Figure 5-6). When the LES value is greater than the GET value, the comparison is TRUE and logic continuity is established.
EQUAL TO, An equal-to comparison is made with the GET and EQU instructions (Figure 5-7). 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.
LESS THAN OR EQUAL TO, This compari- son is made using the GET, LES and EQU instructions. The GET value is the changing value. The LES and EQU instructions are assigned a reference value (Figure 5-8). When the GET value is either less than or equal to the value at the LES and EQU instructions, the comparison is TRUE and logic continuity is established.
NOTE: Only one GET instruction is required for a parallel comparison. The LES and EQU instructions are programmed on parallel branches.
GREATER THAN OR EQUAL TO, This comparison is made using the GET, LES and EQU instructions. The GET value is assigned a reference value. The LES and EQU values are changing values that are compared to the GET value (Figure 5-9). When the LES and EQU values are greater than or equal to the GET value, the comparison is TRUE and logic continuity is established.
NOTE: Only one GET instruction is required for this parallel comparison. The LES and EQU instructions are programmed on parallel branches.
5.2.2 GET BYTE and LIMIT TEST Instructions
The GET BYTE and LIMIT TEST instructions [B] and [L] are used together to compare an octal value to upper and lower limits that are
OPTIONAL CONDITION
120 030 031 t - GE <| 02 499. YYY
REFERENCE VALUE
010 { \
01
WHEN YYY > 499, GET/LES COMPARISON IS TRUE AND 010/01 IS ENERGIZED
FIGURE 5-6, GREATER THAN Comparison
OPTIONAL CONDITION
120 030 035 t - | GE = 03 YYY 100
SN REFERENCE VALUE
010 { \
02
WHEN YYY = 100, GET/EQU COMPARISON IS TRUE AND 010/02 IS ENERGIZED
FIGURE 5-7, EQUAL TO Comparison
Page 47
Page 5-5 also octal values. These values can range from 000, to 377...
The GET BYTE and LIMIT TEST instructions are programmed in the condition area of the ladder diagram rung. Together they form a single condition for logic continuity. Condition instructions can be programmed before the GET BYTE instruction or after the LIMIT TEST instruction but not between them.
The GET BYTE instruction addresses either the upper or lower byte of a Data Table word. A “1” is entered after the word address for an upper byte; a “0” is entered for the lower byte.
The LIMIT TEST instruction addresses one Data Table word that stores both the upper and lower limits. The upper limit is stored in the upper byte and the lower limit is stored in the lower byte. The upper byte of word 045, would be addressed as 0451. See Figure 5- 10.
The Processor makes a duplicate of the upper or lower byte of the word addressed by the
GET BYTE instruction. The octal value stored at that byte is then compared to the upper and lower octal values of the LIMIT TEST instruction. If the GET BYTE value is equal to or between the LIMIT TEST values, the com- parison is TRUE and logic continuity is
- established.
5.3 PROGRAMMING DATA MANIPULATION INSTRUCTIONS
The Data Manipulation instructions are pro- grammed from the Industrial Terminal key- board with the Processor in the PROGRAM mode. When entered, they are displayed in- tensified and blinking. The default word address above the instruction will have a reverse-video cursor positioned at the first digit. The instruction will continue to blink until all information is entered.
Refer to Table 5-1 for a summarized descrip- tion of these instructions.
OT TIONAL CONDITION
- = 040 ba VW Oy | el
REFERENCE VALUE
WHEN YYY < 237, GET/LES-EQU COMPARISON IS TRUE AND 010/03 IS ENERGIZED
FIGURE 5-8, LESS THAN or EQUAL TO Comparison ae CT TIONAL CONDITION
120 “ox 042 <} z ag YYY 042 ae VALUE VY
WHEN YYY 2 440, GET/LES-EQU COMPARISON IS TRUE AND 010/04 IS ENERGIZED
FIGURE 5-9, GREATER THAN or EQUAL TO Comparison
Page 48
Page 5-6
OPTIONAL CONDITION
\ REFERENCE VALUES
120 0451 050 ae 010 4B} 4 Lt}, , 06 YYY 170 05
WHEN 170, < YYY, < 200, , COMPARISON IS TRUE AND 010/05 IS ENERGIZED
FIGURE 5-10, GET BYTE/LIMIT TEST Comparison
TABLE 5-1, Data Manipulation Instructions
Note: Data Manipulation instructions operate upon BCD values and/or 16 bit data in the Data Table. The word address XXX is displayed above the instruction; the BCD value or data operated upon YYY is displayed beneath it. The BCD value is stored in the lower 12 bits of the word address and can be any value from 000 to 999, except as noted. KEYTOP SYMBOL NS ALON DISPLAY DESCRIPTION -[G]- GET XXX The GET instruction is used with other -[G]- Data Manipulation or Arithmetic YYY instructions. When the rung is TRUE, all 16 bits of the GET instruction are duplicated and the operation of of the instruction following it is performed. -(PUT)- PUT XXX The PUT instruction should be preceded -(PUT)- by the GET instruction. YYY When the rung is TRUE, all 16 bits at the GET instruction address are transferred to the PUT instruction address. -[<]- LESS THAN XXX The LESS THAN instruction should be -[<]- preceded by a GET instruction. YY 3-Digit BCD values at the GET and LESS THAN word addresses are compared. If the logic is TRUE, the rung is enabled. -[=]- EQUAL TO XXX The EQUAL TO instruction should be -[=]- preceded by a GET instruction. YYY 3-digit BCD values at the GET and EQUAL TO word addresses are compared. If equal, the rung is enabled.
Page 49
Page 5-7
TABLE 5-1, Data Manipulation Instructions (cont.)
INSTRUCTION DISPLAY DESCRIPTION
KEYTOP SYMBOL NAME
-[B]- GET BYTE XXXD D - Designates the upper or lower byte of -[B]- the word. 1 = upper byte, 0 = lower byte.
YYY YYY - Octal value from 000, to 377, is stored in the upper or lower byte of the word address.
The GET BYTE instruction should be followed by a LIMIT TEST instruction.
A duplicate of the designated byte is made and compared with the upper and lower limits of the LIMIT TEST instruction.
-(L]- LIMIT TEST XXX AAA AAA - Upper limit of LIMIT TEST, an -[L] - octal value from 000, to 377,
BBS BBB - Lower limit of LIMIT TEST, an octal value from 000, to 377,,.
The LIMIT TEST instruction should be preceded by a GET BYTE instruction. Compares the value at the GET BYTE instruction with the values at the LIMIT TEST instruction. If found to be between or equal to the limits, the rung is enabled.