The text of a manual · part 33 of 59
Mini-PLC-2/02, -2/16, -2/17 Processor (cat. no. 1772-LZ, LZP, LX, LXP, LW, LWP) User Manual: 18 - Block Transfer, pages 266 to 274
Pages 266 to 274 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.5 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-LX / LXP
Page 266
Chapter
18
Block Transfer
Chapter Objectives
This chapter describes 3 types of block transfer: read write bi-directional Block transfer is a combination of an instruction and support rungs used to transfer as many as 64 16-bit words of data in one scan from I/O modules to/from the data table. This transfer method is used by intelligent I/O modules such as the analog, PID, servo positioning, stepper positioning, ASCII, thermocouple, or encoder/counter modules. Block transfer can be performed as a read, write, or bi-directional operation, depending on the I/O module you are using. An input module uses the read operation, an output module uses the write operations. During a read operation, data is read into the data table from the module. During a write operation, data is written to the output module from the data table.
Basic Operation
The processor uses two I/O image table bytes to communicate with block transfer modules. The byte corresponding to the module’s address in the output image table (control byte) contains the read or write bit for initiating the transfer of data. The byte corresponding to the module’s address in the input image table (status byte) is used to signal the completion of the transfer. Important: Do not use word 127 for data storage. Block transfer requires the output image table byte and the corresponding input image table byte. Word 127 cannot be used since its corresponding image table byte, word 027, contains the processor status bits. Whether the upper or lower byte of the I/O image table word is used depends on the position of the module in the module group. When the module is in the left slot, the lower byte is used and vice versa (Figure 18.1).
18-1
Page 267
Chapter 18 Block Transfer
Figure 18.1 Image Table Byte Relationship versus Module Position I/O rack
Data table
Output image table word, lower byte
17
Bit numbers 10 07
00
Output image table Control byte
010 012
Block transfer module
017
Input image table word, lower byte
Input image table Status byte
110
112 117
The lower byte of the I/O image table words are used when the module is in the lower slot.
Lower slot
Upper slot 10222
The block transfer read or write operation (Figure 18.2) is initiated in the program scan and completed in the I/O scan as follows: Program scan – When the rung goes true, the instruction is enabled. The number of words to be transferred and the read or write bit that controls the direction of transfer are set by a bit pattern in the control byte in the output image table. I/O scan – The processor requests a transfer by sending the output image table byte of data to the block transfer module during the scan of the output image table. The module signals the processor that it is ready to transfer. The processor then interrupts the I/O scan and scans the timer/counter accumulated area of the data table, looking for the address of the module that is ready to transfer.
18-2
Page 268
Chapter 18 Block Transfer
Figure 18.2 Block Transfer Timing Diagram Transfer is made in I/O Scan Output Scan
Input Scan
Request is made in Program Scan
10377-I
The module address is stored in the timer/counter accumulated area in the same manner as an accumulated value of a timer. The word address at which the module address is stored is called the data address of the instruction. Once the module address is found, the processor locates the address of the file to which (or from which) the data is transferred. The file address is stored in BCD at an address 1008 above the address containing the module address. This is done in the same manner that the processor locates the preset value of a timer/counter in a word address 1008 above the accumulated value address. The analogy between block transfer and timer/counter data and addresses is shown in Table 18.A. Table 18.A Timer and Counter Block Transfer Analogy Timer/Counter
Block Transfer
Address of Accumulated Value Accumulated Value in BCD Address of Preset Value Preset Value of BCD
Data Address of Instruction Module Address in BCD 1008 Above Data Address File Address in BCD
After locating the file address in the preset timer/counter area of the data table, the processor then duplicates and transfers the file data consecutively one word at a time until complete, starting at the selected file address. At the completion of the transfer, a done bit for the read or write operation is set in the status byte in the input image table as a signal that a valid transfer has been completed.
18-3
Page 269
Chapter 18 Block Transfer
Block Transfer Format
The format of a block transfer read and a block transfer write instruction with default values is shown in Figure 18.3. Figure 18.3 Block Transfer Format BLOCK X FER READ DATA ADDR:
030
MODULE ADDR:
100
BLOCK LENGTH:
01
FILE:
110- 110
BLOCK X FER WRITE DATA ADDR:
030
MODULE ADDR:
100
BLOCK LENGTH:
01
FILE:
110- 110
Numbers shown are default values. The number of default address digits initially displayed (3 or 4) depends on the size of the data table.
Here is an explanation of each value: This Value:
Stores the:
Data Address
First possible address in the timer/counter accumulated value area of the data table
Module Address
RGS for R = rack, G = module, S = slot number
Block Length
Number of words to be transferred (enter 00 for default value or for 64 words)
File
Address of the first word of the file
Enable bit -(EN)-
Automatically entered from the module address Set on when the rung containing the instruction is true
Done bit -(DN)-
Automatically entered from the module address Remains on for 1 program scan following successful transfer
18-4
010 EN 07 110 DN 07 010 EN 06 110 DN 06
Page 270
Chapter 18 Block Transfer
Data Address The data address stores the module address of the block transfer module. The data address must be assigned the first available address in the timer/counter accumulated area of the data table. This depends on the number of I/O racks being used (Table 18.B). When more than 1 block transfer module is used, consecutive data addresses must be assigned ahead of addresses for timer and counter instructions. Table 18.B Block Transfer Addressing 2-slot
030
1-slot
030
1/2-slot
050
Block transfer data addresses should be consecutive numbers (for example 030, 031, 032, etc.). A 1-word space or boundary should be left after the last block transfer data address. When the processor sees this boundary word, it will not search further for block transfer data. In addition, the processor is prevented from finding other BCD values that could, by chance, be in the same configuration as the rack, group and slot numbers found in block transfer data addresses. The boundary word data bits can be set to zero manually with bit manipulation. Use [Search] [5][3] and insert zeros. Program a Get/Put transfer assigning Get and Put instructions to the address immediately following the last block transfer data address (Figure 18.4). The value of the Get instruction is set to 000 when programmed. Figure 18.4 Defining the Data Address Area
Data Table
032 G 000
1
0
0
030
1
1
0
031
0
0
0
032
First word in accumulated area of data table
Last consecutive data address contains zero to separate block transfer addresses from timer. counter and storage addresses.
032 PUT 000 10378-I
18-5
Page 271
Chapter 18 Block Transfer
Module Address The module address is stored in BCD with the first digit representing the rack number, the second digit the I/O group number and the third digit the slot number. When block transfer is performed, the processor searches the timer/counter accumulated area of the data table for a match of the module address. When a match is found, the processor looks 1008 above that value to find the address of the block transfer data file. Block Length The block length is the number of words that the module will transfer. It depends on the type of module and the number of channels connected to it. The number of words requested by the instruction must be a valid number for the module: i.e. from 1 up to the maximum of 64. The maximum number depends on the type of module that is performing block transfer. The block length can also be set at the default value of the module (useful when programming bi-directional block transfers). For some modules, the default value allows the module to decide the number of words to be transferred. See the documentation for the module. The block length heading of the instruction accepts any value from 00-63, whether or not valid for a particular module. Enter 00 for the default block length of 64. The block length is stored in binary in the byte corresponding to the module’s address in the output image table. Equal Block Lengths When the block lengths are set equal or when the default block length is specified by the programmer, the following considerations are applicable: Read and write instructions could and should be enabled in the same scan (separate but equal input conditions). Read and write instructions should be enabled in the same scan. Module decides which operation will be performed first when both instructions are enabled in the same scan. Alternate operation will be performed in a subsequent scan. Transferred data should not be operated upon until the done bit is set.
18-6
Page 272
Chapter 18 Block Transfer
Unequal Block Lengths Consult the documentation for the block transfer module for programming guidelines when setting the block lengths to unequal values.
ATTENTION: When the block lengths of bi-directional block transfer instructions are set to unequal values, the rung containing the alternate instruction must not be enabled until the done bit of the first transfer is set. If they are enabled in the same scan, the number of words transferred may not be the number intended, invalid data could be operated upon in subsequent scans, or analog output devices could be controlled by invalid data. Unexpected and/or hazardous machine operation could occur. Damage to equipment and/or personal injury could result.
File Address The file address is the first word of the file to which (or from which) the transfer is made. The file address is stored 1008 words above the data address of the instruction. When the file address is entered into the instruction block, the industrial terminal computes and displays the ending address based on the block length. When reserving an area for a block transfer file, an appropriate address must be selected to ensure that block transfer data does not write over assigned timer/counter accumulated and preset values. The file address cannot exceed address 3577 for a Mini-PLC-2/02, 7577 for a Mini-PLC-2/16, or 17177 for a Mini-PLC-2/17. Enable/Done Bit The read and write bits are the enable bits for block transfer modules. Either one (or both for a bi-directional transfer) is set on in the program scan when the rung containing the block transfer instruction is true. The done bit is set on in the I/O scan that the words are transferred, provided that the transfer was initiated and successfully completed. The done bit remains on for only one scan. A block transfer is requested in each program scan that the read and/or write bit remains on. The read and/or write bits are turned off when the rung containing the instruction goes false.
18-7
Page 273
Chapter 18 Block Transfer
Run-Time Errors Misuse and/or inadvertent changes of instruction data can cause run-time errors when: The module address is given a non-existent I/O rack number. A read transfer overruns the file into a processor work area or into user program by an inadvertent change of the block length code.
Block Transfer Read
Block transfer reads data from an I/O module into the processor’s input image table in one I/O scan. Programmed as an output instruction. Block length depends on the type of module you are using. Request for transfer is made in the program scan. I/O scan is interrupted for the transfer. Done bit remains on for one scan after a valid transfer. Instruction requires two words of the data table. Figure 18.5 shows an example rung containing a block transfer read instruction and the data table areas used by the instruction.
18-8
Page 274
Chapter 18 Block Transfer
Figure 18.5 Data Table Locations for Block Transfer Read 010 Output Image Table
R 1
Data Table Block Length Code
012
Output image table byte contains read enable bit and block length in binary code.
017 027 1 Timer/ Counter Accumulated Area
2
1
Data Address contains module address in BCD.
060
First File Word
067
Last File Word
Block Transfer Data
110
R
Input Image Table
030
1
112
Input image table byte contains done bit.
117
0
Timer/ Counter Preset Area
6
0
130
Storage location of file address contains file address in BCD. R = Bit 17 = Read
113 02
Block Transfer Read Data Addr: Module Addr: Block Lengrth: File:
030 121 08 060-067
012 EN 17 112 DN 17
10225-I
18-9