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

The text of a manual · part 15 of 70

SLC 500 Instruction Set Reference Manual, pages 141 to 150

Pages 141 to 150 of 694

The original document is the PDF (7.2 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 1747-L514

Page 141

Application Specific Instructions

7-5

Use BSR When the rung goes from false-to-true, the enable bit (EN bit 15) is set and the data block is shifted to the right (to a lower bit number) one bit position. The specified bit at the bit address is shifted into the last bit position. The first bit is shifted out of the array and stored in the unload bit (UL bit 10) in the status byte of the control element. The shift is completed immediately. For wraparound operation, set the position of the bit address to the first bit of the array or to the UL bit, whichever applies. The figure below illustrates how the Bit Shift Right instruction works.

BSR

(EN) (DN)

BIT SHIFT RIGHT File #B3:2 Control R6:15 Bit Address I:23/06 Length 32

Unload Bit (R6:15/10)

47 46 45 63 62 61 INVALID

44 60

43 59

42 58

41 57

40 56

39 55

38 54

37 53 69

36 52 68

35 51 67

34 50 66

33 49 65

32 48 64

32 Bit Array #B3:2

Data block is shifted one bit at a time from bit 69 to bit 32. Source Bit I:23/06

If you wish to shift more than one bit per scan, you must create a loop in your application using the JMP, LBL, and CTU instructions.

Sequencer Instructions Overview

The following general information applies to sequencer instructions.

Effects on Index Register S:24 The value present in the index register S:24 is overwritten when the sequencer instruction is true. The index register value will equal the position value of the instruction.

Publication 1747-RM001G-EN-P - November 2008

Page 142

7-6

Application Specific Instructions

Applications Requiring More than 16 Bits When your application requires more than 16 bits, use parallel multiple sequencer instructions.

TIP

Sequencer Output (SQO) Sequencer Compare (SQC)

If a String element address is used for the file parameter, the maximum length for SLC 5/03 and higher processors is 41 words. Additionally, String element boundaries cannot be crossed.

These instructions transfer 16-bit data to word addresses for the control of sequential machine operations.

Enter Parameters SQO Sequencer Output File #B20:1 Mask 0F0Fh Dest O:2.0 Control R6:20 Length 4< Position 2< SQC Sequencer Compare File #B20:6 Mask 0FFF0h Source I:1.0 Control R6:2 Length 4< Position 2<

EN

Enter the following parameters when programming these instructions.

DN

• File is the address of the sequencer file. You must use the file indicator (#) for this address. EN

Table 7.3 Instructions for Sequential Machine Operation

DN FD

Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •

•

•

•

•

•

Output Instructions

Instruction

Sequencer File Stores

SQO

Data for controlling outputs

SQC

Reference data for monitoring inputs

• Mask (SQO, SQC) is a hexadecimal code or the address of the mask word or file through which the instruction moves data. Set mask bits to pass data and reset mask bits to mask data. Use a mask word or file if you want to change the mask according to application requirements. If the mask is a file, its length will be equal to the length of the sequencer file. The two files track automatically. • Source is the address of the input word or file for a SQC from which the instruction obtains data for comparison to its sequencer file. • Destination is the address of the output word or file for a SQO to which the instruction moves data from its sequencer file.

Publication 1747-RM001G-EN-P - November 2008

Page 143

Application Specific Instructions

7-7

You can address the mask, source, or destination of a sequencer instruction as a word or file. If you address it as a file, the instruction automatically steps through the source, mask, or destination file.

TIP

• Control (SQO, SQC) is the control structure that stores the status byte of the instruction, the length of the sequencer file, and the instantaneous position in the file. You should not use the control address for any other instruction. Table 7.4 Control File Structure 15

14

13

Word 0

EN

DN

Word 1

Length of sequencer file

Word 2

Position

12

11 ER

10

09

08

07

06

FD

Not Used

05

04

03

02

01

00

Status bits of the control structure include: – Found Bit FD (bit 08) - SQC only. When the status of all non-masked bits in the source address match those of the corresponding reference word, the FD bit is set. This bit is assessed each time the SQC instruction is evaluated while the rung is true. – Error Bit ER (bit 11) is set when the processor detects a negative position value, or a negative or zero length value. This results in a major error if not cleared before the END or TND instruction is executed. – Done Bit DN (bit 13) is set by the SQO or SQC instruction after it has operated on the last word in the sequencer file. It is reset on the next false-to-true rung transition after the rung goes false. – Enable EN (bit 15) is set by a false-to-true rung transition and indicates the SQO or SQC instruction is enabled. • Length is the number of steps of the sequencer file starting at position 1. The maximum number you can enter is 255 words. Position 0 is the startup position. The instruction resets (wraps) to position 1 at each cycle completion. The address assigned for a sequencer file is step zero. Sequencer instructions use length +1 word of data table files for each file referenced in the instruction. This applies to the source, mask, and/or destination if addressed as files. A length value that points past the end of the programmed file causes a runtime major error to occur. Publication 1747-RM001G-EN-P - November 2008

Page 144

7-8

Application Specific Instructions

TIP

If you alter a length value with your ladder program, make certain that the altered value is valid.

• Position is the word location or step in the sequencer file from/to which the instruction moves data. A position value that points past the end of the programmed file causes a runtime major error to occur.

TIP

You may use the reset (RES) instruction to reset a sequencer. All control bits (except FD) will be reset to zero. The Position will also be set to zero. Program the address of your control register in the RES (for example,R6:0).

Use SQO This output instruction steps through the sequencer file whose bits have been set to control various output devices. When the rung goes from false-to-true, the instruction increments to the next step (word) in the sequencer file. Data stored there is transferred through a mask to the destination address specified in the instruction. Current data is written to the corresponding destination word every scan that the rung remains true. The done bit is set when the last word of the sequencer file is transferred. On the next false-to-true rung transition, the instruction resets the position to step one. If the position is equal to zero at startup, when you switch the processor from the program mode to the run mode instruction operation depends on whether the rung is true or false on the first scan. • If true, the instruction transfers the value in step zero. • If false, the instruction waits for the first rung transition from false-to-true and transfers the value in step one.

Publication 1747-RM001G-EN-P - November 2008

Page 145

Application Specific Instructions

7-9

The bits mask data when reset and pass data when set. The instruction will not change the value in the destination word unless you set mask bits. The mask can be fixed or variable. If you enter a hexadecimal code, it is fixed. If you enter an element address or a file address for changing the mask with each step, it is variable. The following figure indicates how the SQO instruction works.

SQO SEQUENCER File Mask Dest Control Length Position

Destination O:14.0 15 0000

8 0101

7 0000

0 1010

Mask Value 0F0F 15 8 7 0000 1111 0000

0 1111

Sequencer Output File #B10:1 Word B10:1 2 3 4 5

0000 1010 1111 0101 0000

0000 0010 0101 0101 1111

0000 1111 0100 0101 0000

0000 0101 1010 0101 1111

Step 0 1 2 3 4

(EN)

OUTPUT #B10:1 0F0F O:14.0 R6:20

(DN) 4 2

External Outputs Associated with O:14 00 01 02 03 04 05 06 07 08 09 10 Current Step 11 12 13 14 15

ON ON

ON ON

Publication 1747-RM001G-EN-P - November 2008

Page 146

7-10

Application Specific Instructions

Use SQC When the status of all non-masked bits in the source word match those of the corresponding reference word, the instruction sets the found bit (FD) in the control word. Otherwise, the found bit (FD) is cleared. The bits mask data when reset and pass data when set. The instruction will not change the value in the destination word unless you set the mask bits. The mask can be fixed or variable. If you enter a hexadecimal code, it is fixed. If you enter an element address or a file address for changing the mask with each step, it is variable. When the rung goes from false-to-true, the instruction increments to the next step (word) in the sequencer file. Data stored there is transferred through a mask and compared against the source data for equality. If the source data equals the reference data, the FD bit is set in the SQC’s control counter. Current data is compared against the source every scan that the rung evaluates as true.

Publication 1747-RM001G-EN-P - November 2008

Page 147

Application Specific Instructions

7-11

Applications of the SQC instruction include machine diagnostics. The following figure explains how the SQC instruction works.

SQC SEQUENCER File Mask Source Control Length Position

(EN) (DN) (FD)

COMPARE #B10:11 FFF0 I:3.0 R6:21 4 2

Input Word I:3.0 0010 0100 1001

1101

Mask Value FFF0 1111 1111 1111

0000

Sequencer Ref File #B10:11 Word B10:11 12 13 0010 0100 1001 0000 14 15

Step 0 1 2 3 4

SQC FD bit is set when the instruction detects that an input word matches (through mask) its corresponding reference word. The FD bit R6:21/FD is set in the example, since the input word matches the sequencer reference value using the mask value.

Publication 1747-RM001G-EN-P - November 2008

Page 148

7-12

Application Specific Instructions

The SQL instruction stores 16-bit data into a sequencer load file at each step of sequencer operation. The source of this data can be an I/O or storage word address, a file address, or a constant.

Sequencer Load (SQL)

Enter Parameters SQL Sequencer Load File #B20:0 Source I:1.0 Control R6:3 Length 2< Position 1<

EN

Enter the following parameters when programming this instruction.

DN

Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •

•

•

•

•

• File is the address of the sequencer file. You must use the indexed file indicator (#) for this address. • Source can be a word address, file address, or a constant (-32768 to 32767).

•

Output Instruction

If the source is a file address, the file length equals the length of the sequencer load file. The two files will step automatically, per the position value. • Length is the number of steps of the sequencer load file (and also of the source if the source is a file address), starting at position 1. The maximum number you can enter is 255 words. Position 0 is the startup position. The instruction resets (wraps) to position 1 at each cycle completion. The position address assigned for a sequencer file is step zero. Sequencer instructions use length plus one word of data for each file referenced in the instruction. This applies to the source if addressed as a file. A length value that points past the end of the programmed file causes a runtime major error to occur.

TIP

If you alter a length value with your ladder program, make certain that the altered value is valid.

• Position is the word location or step in the sequencer file to which data is moved. A position value that points past the end of the programmed file causes a runtime major error to occur.

TIP

Publication 1747-RM001G-EN-P - November 2008

If you alter a length value with your ladder program, make certain that the altered value is valid.

Page 149

Application Specific Instructions

7-13

• Control is a control file address. The status bits, length value, and position value are stored in this element. Do not use the control file address for any other instruction. The control element is shown below.

Table 7.5 Control File Structure 15 Word 0

EN

Word 1

Length

Word 2

Position

14

13 DN

12

11 ER

10

9

8

7

6

5

4

3

2

1

0

Not Used

Status bits of the control structure include: – Error Bit ER (bit 11) is set when the processor detects a negative position value, or a negative or zero length value. – For SLC processors, this results in a major error if not cleared before the END or TND instruction is executed. – Done Bit DN (bit 13) is set after the instruction has operated on the last word in the sequencer load file. It is reset on the next false-to-true rung transition after the rung goes false. – Enable Bit EN (bit 15) is set on a false-to-true transition of the SQL rung and reset on a true-to-false transition.

Publication 1747-RM001G-EN-P - November 2008

Page 150

7-14

Application Specific Instructions

Operation Instruction parameters have been programmed in the SQL instruction shown below. Input word I:1.0 is the source. Data in this word is loaded into integer file #N7:30 by the sequencer load instruction. SQL SEQUENCER File Source Control Length Position

LOAD #N7:30 I:1.0 R6:4

8 0101

7 0000

0 1010

Sequencer Output File #N7:30 Word N:7:30 31 32 33 34

0000 1010 0000 0000 0000

0000 0010 0101 0000 0000

0000 1111 0000 0000 0000

0000 0101 1010 0000 0000

(DN) 4 2

Source I:1.0 15 0000

(EN)

Step 0 1 2 3 4

External Inputs Associated with I:1.0 00 01 ON 02 03 ON 04 05 06 Current Step 07 08 ON 09 10 ON 11 12 13 14 15

When rung conditions change from false-to-true, the SQL enable bit (EN) is set. The control element R6:4 increments to the next position in the sequencer file, and loads the contents of source I:1.0 into this location. The SQL instruction continues to load the current data into this location each scan that the rung remains true. When the rung goes false, the enable bit (EN) is reset. The instruction loads data into a new file element at each false-to-true transition of the rung. When step 4 is completed, the done bit (DN) is set. Operation cycles to position 1 at the next false-to-true transition of the rung after position 4. If the source were a file address such as #N7:40, files #N7:40 and #N7:30 would both have a length of 5 (0 to 4) and would track through the steps together per the position value.

Publication 1747-RM001G-EN-P - November 2008