The text of a manual · part 13 of 14
Mini-PLC-2 Programmable Controller Programming and Operations Manual, pages 121 to 130
Pages 121 to 130 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 121
Page 12-1
SECTION 12 SCAN TIME AND INSTRUCTION EXECUTION TIMES
12.0 GENERAL
In order for the Processor to implement the User Program, it must evaluate the action that it must take based on monitoring the status of input conditions. In addition, it must control the status of output devices in accordance with the program logic. Every instruction in User Program requires execution time. Execu- tion times vary greatly depending upon the instruction, the amount of data to be operated on and whether the instruction is FALSE or TRUE.
12.1 SCAN TIME
Scan time is the amount of time it takes the Processor to monitor and update inputs and outputs, and to execute instructions in mem- Ory in accordance with User Program. The scan is performed serially, first the I/O Image
Table is updated, (other parts of the Data Table are not scanned), then the User Program.
Scan time is typically 23 msec fora program of 900 instructions. The scan time is increased by approximately 3 msec when the Industrial Terminal is connected to the Processor. When the Communication Adapter Module or the PLC-2 Family/RS-232-C Interface Module, 1771-KA or 1771-KG, respectively, is con- nected to the Processor, the scan time is increased by approximately 5 msec.
12.1.1 Determination of Average Scan Time (1772-LN3 Processor)
Using the scan counter described in Section 11.1, a brief program can be written to display average scan time (See Figure 12-1). For
050
BRANCH END INSTRUCTION ao 050
{CTU) - PR 999 AC 000
2 ?
050
{CTU} PR 999 AC 000
051
14
050 051 STORE 1, - ({RT0) - 0.1
PR 999
AC xxx
STORE 2 STORE3
4H H4GE4 GL A} 4-4 14 xxx 010 XXX 2 XXX 050 051 i {RTR} - 14 PR 999 AC 000 050 050 6H - - - {cTR) 14 PR 999 AC 000
FIGURE 12-1, Scan Time Program
Page 122
Page 12-2 example, the time required to complete 1000 scans can be monitored using a timer and GET/PUT transfer instructions. With a time base of 0.1 seconds, the average scan time can be read directly in milliseconds.
The scan time is displayed as the timer Accumulated value beneath the GET or PUT instruction.
NOTE: The displayed average scan time includes both the I/O scan time of approxi- mately 1 msec and the User Program scan time.
WARNING: The lower limit of input device cycle time should not be less than the scan time of the Processor. If so, incorrect input data could be used during program execu- tion. This could cause unpredictable mach- ine operation and possibly cause damage to equipment and/or injury to personnel.
Critical inputs can be monitored and critical outputs can be controlled in an accelerated manner using the I/O Update Instructions described in Section 7.2.
12.2 WATCHDOG TIMER
The Processor contains an internal watchdog timer that sets an upper limit for the scan time. If the scan time should exceed the limit, a Processor fault would occur and the Pro- cessor would shut down. The watchdog timer is factory set at 180 MS.
12.3 INSTRUCTION EXECUTION TIMES
Execution times in microseconds for each instruction are presented in Table 12-1. Two execution times are given: when the instruc- tion is FALSE, and an average execution time when the instruction is TRUE. For some in- structions, the execution time will depend on other circumstances described below.
12.3.1 MULTIPLY and DIVIDE Instructions (1772-LN3 Processor)
The execution times for these instructions depend on the values of the numbers being computed. Generally, the larger the number, the longer the execution time.
12.3.2 Instructions Within a ZCL Zone
In addition to the ZCL instruction itself, when the rung containing the ZCL instruction is FALSE (i.e., outputs are controlled by the zone), the time required to scan each instruction between the Start Fence and End Fenceis 15 microseconds.
12.4 BLOCK TRANSFER PROGRAMMING
In addition to the time required to execute the instruction in the program scan, the I/O scan is also interrupted while data is transferred. The delay is proportional to the number of words transferred and may vary from one kind of module to another. Consult the 1/O Module User’s Manual.
Page 123
Page 12-3
Table 12-1 Instruction Execution Times
Approximate Execution Time per scan (in microseconds)
Instruction Name
Instruction FALSE
Instruction TRUE (avg)
EXAMINE ON, EXAMINE OFF OUTPUT ENERGIZE OUTPUT LATCH, OUTPUT UNLATCH
GET PUT
EQUAL LESS THAN
GET BYTE LIMIT TEST
COUNTER RESET RETENTIVE TIMER RESET
TIMER ON-DELAY RETENTIVE TIMER ON-DELAY TIMER-OFF DELAY
UP COUNTER DOWN COUNTER
ADD SUBTRACT
MULTIPLY DIVIDE
MASTER CONTROL RESET ZONE CONTROL LAST STATE
BRANCH START BRANCH END
IMMEDIATE INPUT IMMEDIATE OUTPUT
17 28 22
22
36 41
28
23 23
45 46 60
63 82
22 26
35 35
31 45 (See 12.3.2)
24 26
92 22
17 28 27
28 36
36 41
15 28
35 43
80 81 102
105 100
56 77 for (+) or 100 for (-)
230-520 (See 12.3.1) 162-775 (See 12.3.1)
31 35
24 26
92 120
Page 124
Page 125
Page 13-1
Section 13 NUMBERING SYSTEMS
13.0 GENERAL
There are four numbering systems used with Allen-Bradley programmable controllers. They are:
¢ Decimal
¢ Octal
¢ Binary e Hexadecimal
These numbering systems differ by their number sets and place values.
13.1 DECIMAL NUMBERING SYSTEM
The decimal numbering system uses a number set made up of ten digits: the numbers 0 through 9. All decima! numbers are composed of these digits. The value of a decimal number depends on the digits used and the place value of each digit.
Each place value in a decimal number repre- sents a power of ten (Figure 13-1), starting with 10°. (Any number raised to the zero power is equal to 1) The value of a decimal number is determined by multiplying each digit by its corresponding place value and adding these numbers together.
number set is composed of eight digits: the numbers 0 through 7.
Each digit in an octal number has a certain place value, represented by a power of eight (Figure 13-2).
3x B7=192 192 5x 8'=40 40 0 7 7xe=7 23910 3/5 ],7], 23910= 357,
2x 10= 20010 ag 3 x 10'= 3010 9 9x 10° = 910 23910
FIGURE 13-1, Decimal Numbering System
13.2 OCTAL NUMBERING SYSTEM
The octal numbering system is used to address word and bit locations in the Data Table. Its
FIGURE 13-2, Octal Numbering System
The decimal value of an octal number is computed by multiplying each octal digit by its place value and adding these numbers together.
13.3 BINARY NUMBERING SYSTEM
The binary numbering system is a number set that consists of two digits: the numbers 0 and 1. All information in memory is stored as an arrangement of 1’s and 0’s.
Each digit in a binary number has a certain place value expressed as a power of two (Figure 13-3). The decimal equivalent of a binary number is computed by multiplying each binary digit by its corresponding place value and adding these numbers together.
By grouping several binary digits together, values can be formed to represent decimal, hexadecimal or octal numbers.
13.3.1 Binary Coded Decimal
Binary Coded Decimal (BCD) uses an arrange- ment of 12 binary digits to represent a 3-digit decimal number from 000 to 999 (Figure 13-4). Each group of 4 binary digits is used to represent a decimal number from 0 to 9. The
Page 126
Page 13-2 digit by its corresponding place value and 1x 2?- 198 adding these numbers. 1x 28-64 13.3.2 Octal Representation 1x 25-39 Octal Representation is an arrangement of 8 bits (one byte) to represent a 3-digit octal Ox2*=0 408 number from 000, to 377, (Figure 13-5). The 8 1x 22=8 bits are separated into three groups: 2 bits, 3 1xoe=4 8 bits and 3 bits. 4 1x21=9 2 TABLE 13-1, BCD Representation ixely PLACE VALUE - - - - 2391 DECIMAL 2° 2? 2' 2° EQUIVALENT tlalatolalatalal, (8) | (4) | (2) | (1) 111011112 = 2391 0 0 0 0 0 0 0 0 1 1 0 0 1 0 2 FIGURE 13-3, Binary Numbering System 0 0 1 1 3 0 1 0 0 4 0 1 0 1 5 place values for each group of 4 digits are 20, 0 1 1 0 6 21, 22 and 23 (Table 13-1). 0 1 1 1 7 1 0 0 0 8 The decimal equivalent for a group of 4 binary 1 0 0 1 9 digits is determined by multiplying the binary 0x 23=0 Ox 22=0 1x 2'=2 0x 2°=0 0x 23=0 0x 22=0 1x21=2 3 0x 2°=0 1x 23=8 Ox 22=0 9 0x 2'=0 10 1x 20=4 O10/1;/0;/o0;}/o0/]11]1 0} 0] 1 \ - - /N. / VW WwW MW 2 3 9
FIGURE 13-4, Binary Coded Decimal
Page 127
Page 13-3, a = oO a4, = =
FIGURE 13-3, Numbering System Conversion
FIGURE 13-5, Octal Representation
The octal number for each group of bits is determined by multiplying the binary digit by its corresponding place value and adding these numbers together. (Table 13-2).
TABLE 13-2, Octal Representation
PLACE VALUE OCTAL
2? 2" 2° EQUIVALENT
(4) | (2) | ()
0 0 0 0
0 0 1 1
0 1 0 2
0 1 1 3
1 0 0 4
1 0 1 5
1 1 0 6
1 1 1 7
13.4 HEXADECIMAL NUMBERING SYSTEM
The hexadecimal numbering system has a number set of 16 digits: the numbers 0-9 and the letters A-F (Table 13-3). The letters A-F represent the decimal numbers 10-15 respec- tively.
A hexadecimal number can be converted to a decimal number by multiplying the hexadeci- mal digit by its corresponding place value (Figure 13-6). ,
Chart HEXA- DECIMAL BINARY DECIMAL
0 0000 0 1 0001 1 2 0010 2 3 0011 3 4 0100 4 5 0101 5 6 0110 6 7 0111 7 8 1000 8 9 1001 9 A 1010 10 B 1011 11 Cc 1100 12 D 1101 13 E 1110 14 F 1111 15
0x 16°=0
1x 162 = 256
256 10 x 16" = 160 00 7x 16057 42310 = O1A7i5 O11; Al7
FIGURE 13-6, Example of Hexadecimal to Decimal Conversion
Because each hexadecimal digit represents 4 binary digits, it is easy to convert a hexadecimal number to a binary number. This is done by writing out the 4-bit binary pattern for each hexadecimal digit (Figure 13-7).
Page 128
Page 13-4
Ci/2/AlF as / | \ N 7 \ N oO / | \ ~Y Yo J | \ X wa / | \ XN 7 7 | \ aN YO / I \ N / | \ N a \ N Z / | \ “ Yo 7 I \ SY 7 / I \ ~
FIGURE 13-7, Example of Hexadecimal to Binary Conversion
Page 129
Page I-1
Accumulated Value 4-1 ADD; (+) 6-1
Address Delimiters 10-5 Addressing
Terminology 1-4 Method 9-1
ASCII Control Codes 10-8
BCD format 4-1, 5-1, 13-1 Baud Rate Setting 10-1 Bit 1-2 Bit Manipulation and Monitor 9-7 Bit Number 1-2, 1-4 Block Transfer Bidirectional 11-4 Buffering Data 11-9 Loading Zeros’ 11-7 Number of Words Transferred 11-7 Operation 11-1 Programming 11-3 Boundaries to User Program Cursorto 9-5 END Statement 9-11 TEMPORARY END 9-11 BRANCHING, START and END 3-4 Buffering Data 11-9 Byte 1-5
Cascading Timers or Counters 4-9 Cassette Recording 10-10
Clear Memory Functions 9-12 Contact Histogram 10-2 COUNTER, DOWN -(CTD)- 4-8 COUNTER, RESET -(CTR)- 4-8 COUNTER, UP-(CTU)- 4-6
Data Cartridge Recording 10-12 Data Highway Compatibility 1-5 Data Table Factory Configured 1-4 Adjustment 9-1 Size Determination 8-7 Data Table Documentation Forms 8-5 Delimiter 10-5 Diagnostic Bit 11-9
INDEX
Diagnostic Indicators 2-1, 2-2 Directories 9-5 DIVIDE (+) 6-2
Editing Functions 9-2 EQU--|- 5-3 ERR Message Illegal Opcode 9-12 Incompatable Instructions 1-8 EXAMINE ON 4- |- 3-1 EXAMINE OFF -/- 3-1 Execution Time 12-3
Forced Address Display 9-11 Forcing Functions 9-9
GET -[G]-, 5-2 GET BYTE-[B]- 5-4 Graphic Display 10-7
Illegal Opcode 9-12 Image Table Byte, Block Transfer IMMEDIATE INPUT -[I]- 7-3 IMMEDIATE OUTPUT -(IOT)- 7-4 Industrial Terminal Compatability when using 1770-T1, or -T2 Connection Diagram 2-3 Control Codes and Special Commands Initialization 2-4 Instruction Address 1-4 Instruction Tables Arithmetic Instructions 6-4 Counter Instructions 4-12 Data Manipulation Instructions 5-6 1/O Update Instructions 7-6 Output Override Instructions 7-6 Relay-Type Instructions 3-6 Timer Instructions 4-11 Intelligent |/O Modules 11-1 1/O Image Table 1-3
Keytop Overlay PLC-2 (Cat.No.1770-KCA) 2-5
Alphanumeric (Cat. No. 1770-KAA) 10-3
1-5
10-6
Alphanumeric/Graphic (Cat. No. 1770-KAB)
10-3
Page 130
Page I-2
Last state of Outputs 2-3 LES -[<]- 5-3 LIMIT TEST -[L]- 5-4
MASTER CONTROL RESET -(MCR)- 7-1 Memory Layout Display 9-1 Memory Organization Definition 1-3 Word Assignment Considerations 8-6 Adjusting the Data Table 9-1 Developing the Data Table 8-5 Storage Considerations 8-7 Message Control Word 10-9 Message Generation 10-7 Modes of Processor Operation 2-1 Module Address, Block Transfer 11-3 Module Group _ 1-4, 1-6 MULTIPLY -(X)- 6-2
Nested Programming 3-5 Numbering Systems 13-1
On-Line Datachange 9-5 One-Shot 11-9
OUTPUT ENERGIZE -()- 3-2 OUTPUT LATCH -(L)- 3-3 OUTPUT UNLATCH -(U)- 3-3
PC Operation 1-3
Preset Value 4-1
Print Out Automatic Report Generation 10-7 Contact Histogram 10-2 Total Memory Dump 10-13
Programming see Instruction Tables Developing the DataTable 8-5 Hardware Program Interface 1-3 Memory Organization 1-3 Program Recommendations 8-8 Sample Program 8-1
0.01 Second Timers 11-11 PUT -(PUT)- 5-2
Report Generation Direct Access at Power Up 10-7 Simultaneous Message Requests 10-10
Scan Counter 11-1 Scan Sequence 7-2
Scan Time Determination of 12-1 Typical 7-2
Search Functions 9-5
Single Rung Display 9-7
Status/Control Bits, Operation of: Arithmetic Instruction 6-1 Automatic Report Generation 10-7 Block Transfer Instructions 11-5, 11-6 Counter Instructions 4-6 Timer Instructions 4-2
Bit/Word Storage Considerations 8-7
SUBTRACT -(-)- 6-1
Switch Group Assembly 2-3
TEMPORARY END 9-11
Timer Accuracy 4-5
TIMER, OFF-DELAY -(TOF)- 4-2 TIMER, ON-DELAY -(TON)- 4-2 TIMER, RETENTIVE -(RTO)- 4-3 TIMER, RETENTIVE RESET -(RTR)- 4-4 Troubleshooting Aids 9-7
Valid Transfer of data 11-9
Word Structure Definition 1-3 Accumulated Value Word 4-2, 4-6 Data Table Organization 1-4 Write Bit, Block Transfer 11-4
ZONE CONTROL LAST STATE -(ZCL)- 7-1