Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 5 of 7

Encoder/Counter Modules User Manual (Cat. Nos. 1771-IJ and 1771-IK), pages 41 to 50

Pages 41 to 50 of 68

The original document is the PDF (388 KB). 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 1771-IK

Page 41

Single Transfer Programming

5–11

In order to keep track of both I/O and program scans, the PLC scan counter rungs manipulate a particular type of memory bit. This must be a bit in the input image table which is not wired to a corresponding input device, so that the bit is turned off each I/O scan. Choose a bit which satisfies all of the following conditions:

• is in a module group that is scanned immediately after the encoder/counter module is scanned • is an actual terminal address on an installed input module • is off at all times The first condition requires a brief knowledge of I/O scan sequencing. The remote I/O PLC processor scans I/O modules in order of module group no. It first scans module group 0 in all I/O racks, then module group 1, then 2 and so on. Therefore, when selecting an input image table bit for scan counter control, choose a bit with a greater module group no. than the module group no. of the encoder/counter module. If the encoder/counter module is placed in module group 7, and unused input in module group 0 would be appropriate for this purpose. Note that the I/O rack number is of no consequence in selecting this bit. The second condition requires that this input address correspond to an actual input module terminal of the controller. For the third condition, it is suggested that the input terminal at the address be connected to the L2 (AC low) or DC COMMON terminal on the input module wiring arm. This helps prevent the terminal from being connected to an input device at some later time. In Figure 5.7, it is assumed that bit 11111 satisfies all three of these conditions. The I/O scan and program scan both manipulate bit 11111. In rung 1, this bit is examined as an input condition for the scan counter. When this bit is OFF, CTU 200 increments. When CTU 200 increments, bit 20017 is set on. In rung 2, bit 20017 latches bit 11111 on. Then, in rung 3, bit 20017 is turned off. Bit 11111 remains on until the next I/O scan. With this arrangement, CTU 0 cannot increment until both an I/O scan and program scan occur. Note that, for the PLC processor, two scan counts are used between each step in single transfer, as indicated in NO TAG.

Publication 1771-UM006B-EN-P - June 2002

Page 42

5–12

Single Transfer Programming

Note: In some applications, it may be feasible to designate an input location for the purpose of scan counter control. In this instance, an on-delay timer (TON) instruction can be used to multiplex output data to the encoder/counter module. A timer with 0.1-second resolution is acceptable for this purpose. Each step of Table 5.A can be programmed to be executed at a 0.1-second interval from the previous step.

Example Program Ć Single Transfer

Figure 5.8 is an example program for single-transfer multiplexing of output words to the encoder/counter module. This example uses the type of scan counter recommended for PLC-2 processors. However, the general format of these rungs would be the same for a PLC processor, with addressing differences, substitution of the type of scan counter shown in Figure 5.7, and other minor changes. Figure 5.8 Example Program Ć Single Transfer

Rung No.

030 CTU PR003 AC000

1

Branch End Instruction

030 CTU PR003 AC000

051 G

012 PUT

052 G

012 PUT

053 G

012 PUT

2

030 G

3

201 = 001

030 G

4

202 = 002

030 G

5

1

203 = 003

1

03015

6

1

For the PLC processor, values of constants would be 003 in rung 4, 005 in rung 5.

Publication 1771-UM006B-EN-P - June 2002

030 CTR

Scan Counter

Output Control Word Output Preset Word #1 Output Preset Word #2 Reset Scan Counter

15959

Page 43

Single Transfer Programming

5–13

The following assumptions are made for this sample program:

• Encoder/counter module is in I/O rack 1, module group 2. • Output control word is stored in word 051. • Preset words #1 and #2 are stored in words 052 and 053, respectively. • The scan counter is recycled, as shown in rung 6. This allows continuous update of the module should output values be changed by the program. For this example, it is assumed that the bit patterns of the output words are set up elsewhere in the program.

Publication 1771-UM006B-EN-P - June 2002

Page 44

5–14

Single Transfer Programming

Publication 1771-UM006B-EN-P - June 2002

Page 45

Chapter

6

Block Transfer Programming General

Block transfer programming is available with all Allen-Bradley processors that use the 1771 I/O structure. Block transfer is specifically intended for use with I/O modules such as the encoder/counter module, that perform more complex operations than simple on/off input sensing or output switching. For the operation of such modules, multiple words of data must be transferred to or from the processor. Block transfer can be particularly useful with the encoder/counter module when more than one word must be output to the module, that is, when one or both preset words are used. By using block transfer in these applications, you can avoid any involvement with multiplexing techniques for module/processor communication. Multiplexing techniques are used in single transfer programming, as described in chapter 5. Note, however, that single transfer techniques can be the easiest to use in any application where only a single output control word must be sent to the module. For this reason, when not using any of the preset words, use single transfer programming for module/processor communication. The material for block transfer is organized as follows:

• Section titled Output Words - Block Transfer describes the configuration of output words when using block transfer. • Section titled Example Block Transfer Programs describes block transfer ladder logic for PLC -2, PLC-3, and PLC-5 family processors.

Output Words - Block Transfer

The output control and preset words have a unique configuration when block transfer programming has been selected. Initially, the program must set the bit combinations of these words to the proper arrangement for the application. Then, through block transfer, these words are transmitted to the encoder/counter module.

Output Control Word Figure 6.1 shows the configuration of the output control word for block transfer. By setting bits in this word, you set up the initial mode of module operation and change it as required during operation.

Publication 1771-UM006B-EN-P - June 2002

Page 46

6–2

Block Transfer Programming

Figure 6.1 Control Word Ć Block Transfer Mode Bit 03, Up/down 1 = count up 0 = count down (Significant in counter mode only) Bits 00-01 Function Control (See Table)

Bits 05-17, Not used. May have any setting

ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ ÉÉ

17 16 15 14 13 12 11 10 07 06 05 04 03 02 01 00

Bit 02, Enable outputs 1 Ć Enable 0 Ć Disable

Bit 04, Home Latch Enable 1 Ć Enable 0 Ć Disable Table Function Control Bits BIT 01

BIT 00

0

0

0

1

1

0

1

1

FUNCTION Count. Reset and hold the accumulated count at 000. Return the accumulated count to 000 and begin counting immediately. Invalid, module executes previously programmed function.

15960

Bit 04 is the home latch enable bit. The module resets the count to zero when all three of the following conditions are true:

• Home latch enable bit (bit 04) is set to 1. • Marker input is high. • Home limit switch is closed (limit switch LED is on). The count remains at zero until one or more of these conditions go false. Then module operation follows the function control bits described in Figure 6.1.

Publication 1771-UM006B-EN-P - June 2002

Page 47

Block Transfer Programming

6–3

The module indicates it has reset its count to zero by setting the home bit (bit 17 in the input status word). It resets this bit when the home latch enable bit (bit 04) is reset. (Refer to Figure 4.2, Input Status Word). The system can bring the machine back to a repeatable starting position, and the module count can be reset to zero by toggling either the market input or home limit switch rather than changing bits 01 and 00 in the control word as long as the three conditions are met. Carry and borrow bits are not affected by resetting the module count. The home limit switch LED turns on whenever the home limit switch is closed. Bit 03 of this word is the up/down bit. This bit is significant only when the module is used in the counter mode. The state of this bit control module function as follows: 1 -The module increments its accumulated count with each pulse received on Channel A. 0 -The module decrements its accumulated count with each pulse received on channel A. Note that if a device is wired to the Channel B input of the module for external count direction, the up/down bit must be set to 1. Bit 02 is the enable outputs bit. The status of this bit controls module outputs as follows: 1 -Outputs enabled. This means that the outputs of the module can be energized based on logical operations performed by the module. 0 -Outputs disabled. This means that the outputs of the module cannot be energized. With bit 02 set to 1, the module can energize its output terminals based on a comparison of its accumulated count and preset values entered by the program. Bits 00 and 01 are termed function control bits. These bits control module function in both encoder and counter modes. They permit the counting function of the module to be enabled or reset by the program. The table in Figure 6.1 shows the bit settings for each function. Bits 05-17 of this word are not used by the module and may have any setting.

Publication 1771-UM006B-EN-P - June 2002

Page 48

6–4

Block Transfer Programming

Preset Words In block transfer communication, preset words #1 and #2 have the format of Figure 6.2. Here bits 00-13 store the preset value. When BCD operation has been selected, these bits may represent a value from 000-999. When 12-bit binary operation has been selected, the value may range from 0 to 1111 1111 1111 binary (4095 decimal). A module switch selection is made during installation to select either BCD or binary mode. Figure 6.2 Preset Words Ć Block Transfer Mode AC > PR AC = PR AC < PR

Bits 15-17, Comparison Parameters for Preset Value Preset Value

17 16 15 14 13 12 11 10 07 06 05 04 03 02 01 00

Most Significant BCD Digit (0-9) 1

Bit 14, Not used

Middle BCD Digit (0-9) 1

Least Significant BCD Digit (0-9) 1

1

1 or, 12-bit binary value Module switch delection determines whether bits 00-13 are of binary or BCD format 15961

Note: If BCD operation has been selected, only BCD digits should be entered in the data table word output to the module. If non-BCD digits are entered in a preset value, the module sets its default preset value to 000 for that word. Bits 15-17 establish the comparison to be made by the module between its accumulated count and each preset value. When any of these bits are set to 1, the module makes the indicated comparison between its accumulated count and the appropriate preset word value. When the comparison is true, the corresponding output of the module may be energized. Of course, the enable outputs bit in the control word must also be set to 1 for outputs to be energized. As Figure 6.2 shows, one bit is used for each comparison parameter: less than, equal to, or greater than. Note that more than one of these bits can be set to 1 for each preset, allowing such combinations as less than or equal to, greater than or equal to, or not equal to. Bit 14 of each preset word is not used. It may be 1 or 0.

Publication 1771-UM006B-EN-P - June 2002

Page 49

Block Transfer Programming

6–5

Note that there is no identifying bit pattern to distinguish preset words #1 and #2 from each other. The encoder/counter module identifies these words by their order of transmission in block transfer. As these words are stored in memory, preset word #1 is stored in the word immediately following the output control word. Preset word #2 is then stored in the word immediately following preset word #1.

Example Block Transfer Programs

The module communicates with any Allen-Bradley processor that has block transfer capability. The module is a bidirectional block transfer module. Bidirectional means that the module performs both read and write block transfer operations. You transfer data from your module to the processor’s data table with a block transfer read (BTR) instruction. You transfer data to your module from the processor’s data table with a block transfer write (BTW) instruction.

PLC-2 Family Processors The following examples use block transfer instructions to perform block transfers. However, the Mini-PLC-2 (cat. no. 1772-LN3) and PLC-2/20 (cat. no. 1772-LP1,-LP2) processors use multiple GET instructions to perform block transfers. Refer to the processor user’s manual for an explanation of multiple GET block transfer. The generalized and example programs (Figure 6.3 and Figure 6.4) demonstrate the use of a single block transfer read (BTR) and a single block transfer write (BTW) to pass data between the processor and the module. Figure 6.3 Generalized Ladder Logic for PLC-2 Block Transfer

BTR DN

BTW

EN

File AAA-BBB

DN

BTR

EN

File CCC-DDD

DN

FFM 1 2

File CCC-DDD File EEE-FFF 1 = source 2 = destination

EN DN

15962

Publication 1771-UM006B-EN-P - June 2002

Page 50

6–6

Block Transfer Programming

Rung Descriptions Rungs 1 and 2 - These rungs request the block transfer write (BTW) and block transfer read (BTR) operations. Rung 3 - When the processor successfully completes a BTR operation, it sets the done (DN) bit and enables the file-to-file move (FFM) instruction. The FFM instruction moves the BTR data file (CCC-DDD) into a storage data file (EEE-FFF). This prevents the processor from using invalid data if a block transfer communications fault should occur. Figure 6.4 Example Ladder Logic for PLC-2 Block Transfer

BLOCK XFER WRITE DATA ADDR: 0050 MODULE ADDR: 101 BLOCK LENGTH: 0 FILE: 0200 - 0277

1

BLOCK XFER READ DATA ADDR: 0051 MODULE ADDR: 101 BLOCK LENGTH: 0 FILE: 0203 - 0302

2

110 17

FILE TO FILE MOVE COUNTER ADDR: 0053 POSITION: 001 FILE LENGTH: 001 FILE A: 0203 - 0203 FILE R: 0204 - 0204 RATE PER SCAN 001

010 EN 16 110 DN 16 010 EN 17 110 DN 17

0053 EN 17 0053 DN 15

15963

For PLC-2 family processors, we recommend that you set the block length to zero. Then the module determines the number of transfer words. The 1771-IJ/IK defaults to 3 words in a BTW and 1 word in a BTR if you program a block length of zero.

Publication 1771-UM006B-EN-P - June 2002