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

The text of a manual · part 66 of 70

SLC 500 Instruction Set Reference Manual, pages 651 to 660

Pages 651 to 660 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 651

Number Systems

1111

1111

1111

F-3

1x214 = 16384 1x213 = 8192 1x212 = 4096 1x211 = 2048 1x210 = 1024 1x29 = 512 1x28 = 256 1x27 = 128 1x26 = 64 1x25 = 32 1x24 = 16 1x23 = 8 1x22 = 4 1x21 = 2 1x20 = 1 32767

1111

1x215 = 32768 This position is always 1 for negative numbers.

Hexadecimal Numbers

Hexadecimal numbers use single characters with equivalent decimal values ranging from 0 to 15.

HEX

0

1

2

3

4

5

6

7

8

9

A

B

C

D

E

F

Decimal 0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

The position values of hexadecimal numbers are powers of 16, beginning with 160 at the right:

163

162

161

160

Example Hexadecimal number 218A has a decimal equivalent value of 8586.

Publication 1747-RM001G-EN-P - November 2008

Page 652

F-4

Number Systems

218A

2x163 = 8192 1x162 = 256 8x161 = 128 10x160 = 10 8586

Hexadecimal and binary numbers have the following equivalence.

Hexadecimal

Binary

218A

= 8586

0010

0001

1000

1010

8192 1x213

256 1x28

128 1x27

10 1x23+1x21

= 8586

Example Decimal number -8586 in equivalent binary and hexadecimal form.

Binary

1101

Hexadecimal

1110

0111

DE76

0110

= -8586

= 56950 (negative number, -8586)

Hexadecimal number DE76 = 13x163+14x162+7x161+6x160 = 56950. We know this is a negative number because it exceeds the maximum positive value of 32767. To calculate its value, subtract 164 (the next higher power of 16) from 56950: 56950 - 65536 = -8586.

Publication 1747-RM001G-EN-P - November 2008

Page 653

Number Systems

Hex Mask

F-5

This is a 4-character code, entered as a parameter in SQO, SQC, and other instructions to exclude selected bits of a word from being operated on by the instruction. The hexadecimal values are used in their binary equivalent form, as indicated in the figure below. The figure also shows an example of a hexadecimal code and the corresponding mask word.

Hex Value

Binary Value

0 1 2 3 4 5 6 7 8 9 A B C D E F

0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Hex Code 00FF

0000

0000

1111

1111

Mask Word

Bits of the mask word that are set (1) will pass data from a source to a destination. Reset bits (0) will not. In the example below, data in bits 0-7 of the source word is passed to the destination word. Data in bits 8-15 of the source word is not passed to the destination word.

Source Word

1110

1001

1100

1010

Mask Word

0000

0000

1111

1111

Destination Word 0 0 0 0 (all bits 0 initially)

0000

1100

1010

Publication 1747-RM001G-EN-P - November 2008

Page 654

F-6

Number Systems

Binary Floating-point Arithmetic

The SLC 5/03, OS301 and higher, SLC 5/04, and SLC 5/05 processors support the use of floating-point. Use floating-point when you want to manipulate numbers outside of the range −32768 to +32767 or for a resolution finer than one unit. For example, 2.075. Floating-point arithmetic does not support non-normalized, Not a Number (NaN), and infinity. The valid range for a floating-point number is ±3.40282 x 1038 to ±1.17550 x 10-38 The following example shows the representation of a floating-point number using the IEEE 754 standard for Single precision floating-point. The following is the spatial representation of the 32 bits in the register.

sign bit exponent fraction sxxxxxxxxmmmmmmmmmmmmmmmmmmmmmmm where: s = sign x = exponent m = mantissa

When converting to floating-point arithmetic, the following must occur. 1. The sign bit must be set. If the number is positive, then the sign bit is 0 or Off. If the number is negative, then the sign bit is 1 or On. 2. The exponent must be normalized. Do this by always adding +127 to the exponent. 3. The mantissa must be normalized. For example, the binary value of 1010.01 equals 1.01001 4. The fraction must be extracted from the mantissa. For example, the fractional part of 1.01001 is .01001. The 32-bit floating-point representation of 10.25 decimal equals: 0 10000010 01001000000000000000000

Publication 1747-RM001G-EN-P - November 2008

Page 655

Appendix

G

Application Example Programs

This appendix is designed to illustrate various instructions described previously in this manual. Application example programs include: • paper drilling machine using most of the instructions. • time driven sequencer using TON and SQO instructions. • event driven sequencer using SQC and SQO instructions. • on/off circuit using basic, program flow, and application specific instructions. • interfacing with enhanced bar code decoders over DH-485. Because of the variety of uses for this information, the user of and those responsible for applying this information must satisfy themselves as to the acceptability of each application and use of the program. In no event will Rockwell Automation be responsible or liable for indirect or consequential damages resulting from the use of application of this information. The illustrations, chart, and examples shown in this appendix are intended solely to illustrate the principles of the controller and some of the methods used to apply them. Particularly because of the many requirements associated with any particular installation, Rockwell Automation cannot assume responsibility or liability for actual use based upon the illustrative uses and applications.

Paper Drilling Machine Application Example

For a detailed explanation of: • XIC, XIO, OTE, RES, OTU, OTL, and OSR instructions, see Chapter 2. • EQU and GEQ instructions, see Chapter 3. • CLR, ADD, and SUB instructions, see Chapter 4. • MOV and FRD instructions, see Chapter 5. • JSR and RET instructions, see Chapter 6. • INT instruction, see Chapter 11. • SQO instruction, see Chapter 7. This machine can drill 3 different hole patterns into bound manuals. The program tracks drill wear and signals the operator that the bit needs replacement. The machine shuts down if the signal is ignored by the operator.

1

Publication 1747-RM001G-EN-P - November 2008

Page 656

G-2

Application Example Programs

OPERATOR PANEL

Start I:1/6 Stop I:1/7

Change Drill Soon

Change Drill Now

O:3/4 Thumbwheel for Thickness in 1/4 in. Drill Change Reset

O:3/6 5 Hole

3 Hole I:1/11-I:1/14

(Keyswitch)

Drilled Holes

I:1/9-I:1/10

I:1/8

Drill Home I:1/5

Drill Depth I:1/4

Quadrature A-B Encoder and Drive I:1/0 I:1/1

Drill On/Off O:3/1 Drill Retract O:3/2 Drill Forward O:3/3 Photo-Eye Reset I:1/2 Counter Hold I:1/3

Photo-Eye Reflector

Conveyor Enable wired in series to the Drive O:3/5 Conveyor Drive Start/Stop wired in series to the Drive O:3/0

Publication 1747-RM001G-EN-P - November 2008

7 Hole

Page 657

Application Example Programs

Paper Drilling Machine Operation Overview

G-3

Undrilled books are placed onto a conveyor taking them to a single spindle drill. Each book moves down the conveyor until it reaches the first drilling position. The conveyor stops moving and the drill lowers and drills the first hole. The drill then retracts and the conveyor moves the same book to the second drilling position. The drilling process is repeated until there are the desired holes per book.

Book Drilling Machine The following ladder logic will start a conveyor in motion when the START button is pressed. There are conditions that must be met before the conveyor will start. The drill must be in it's fully retracted position (home) and the drill bit must not be past its maximum useful life. The conveyor will stop if the stop button is pressed or if the drill life is exceeded.

Start Button I:1

Drill Home Limit Switch I:1

Stop Button I:1

Machine Run Latch B3:0

6 1746-IA16

5 1746-IA16

7 1746-IA16

0

0000

Machine Run Latch B3:0 0 The following rung will control the Activate Drill Motor and Conveyor.

Machine Run Latch B3:0

Drill Motor On O:3

0

1 1746-OA16

0001

B3:0 OSR 1

The following rung will stop the conveyor

Machine Run Latch B3:0 0002 0 if any conditions

Conveyor Start/Stop O:3 L 0 1746-OA16 exist that unlatch the "Machine RUN Latch" bit.

Conveyor Start/Stop O:3 U 0 1746-OA16

Publication 1747-RM001G-EN-P - November 2008

Page 658

G-4

Application Example Programs

The following rung will call the drill sequence subroutine. The subroutine manages the operation the drilling sequence and will restars the conveyor upon completion of the drilling sequence.

JSR Jump T o Subroutine SBR File Number

0003

The following rung will call the subroutine drill bit.

JSR Jump T o Subroutine SBR File Number

The following rung will call the subroutine

First Pass S:1 0005 15

Publication 1747-RM001G-EN-P - November 2008

U:6 that is used to track the amount of wear on the current

0004

0006 of used to initialize logic neseccary

U:7 for the DII on power up.

JSR Jump T o Subroutine SBR File Number

U:4

END

Page 659

Application Example Programs

G-5

Drill Mechanism Operation When the operator presses the start button, the drill motor turns on. After the book is in the first drilling position, the conveyor subroutine sets a drill sequence start bit, and the drill moves toward the book. When the drill has drilled through the book, the drill body hits a limit switch and causes the drill to retract up out of the book. When the drill body is fully retracted, the drill body hits another limit switch indicating that it is in the home position. Hitting the second limit switch unlatches the drill sequence start bit and causes the conveyor to move the book to the next drilling position.

Drill Up & Down Motion The following logic will control the up/down motion of the drill. When the conveyor positions the book under the drill, the DRILL SQUENCE START BIT will be set. This rung uses that bit to begin the drilling operation. Because the bit is set for the entire drilling operation, the OSR is required to be able to turn off the forward signal so the drill can retract.

Drill Sequence Start B3:2 0000

0

Drill Forward O:3 L 3 1746-OA16

B3:3 OSR 0

When the drill has drilled through a book, the body of the drill will actuate the DRILL DEPTH limit switch. When this happens, the DRILL FORWARD signal is turned off and the DRILL RETRACT signal is turned on.

Drill Depth Limit Switch I:1

Drill Forward O:3 U 3 1746-OA16

0001

4 1746-IA16

First Pass S:1

15

Drill Home Limit Switch I:1

Drill Retract O:3 L 2 1746-OA16

5 1746-IA16

Activate Drill Motor and Conveyor.

Drill Home Limit Switch I:1

Drill Retract O:3

5 1746-IA16

2 1746-OA16

Drill Retract O:3 U 2 1746-OA16

0002

Drill Sequence Start B3:2 U 0 Machine Run Latch B3:0

0

0003

Conveyor Start/Stop O:3 L 0 1746-OA16

END

Publication 1747-RM001G-EN-P - November 2008

Page 660

G-6

Application Example Programs

Conveyor Operation When the start button is pressed, the conveyor moves the books forward. As the first book moves close to the drill, the book trips a photo-eye sensor. This tells the machine where the leading edge of the book is. Based on the position of the selector switch, the conveyor moves the book until it reaches the first drilling position. The drill sequence start bit is set and the first hole is drilled. The drill sequence start bit is now unlatched and the conveyor moves the same book to the second drilling position. The drilling process is then repeated until there are the desired holes per book. The machine then looks for another book to break the photo-eye beam and the process is repeated. The operator can change the number of drilled holes by changing the selector switch.

The following rung resets the hole count sequencers each time the processor enters the RUN mode. This ensures that the first p reset value is loaded into the DII preset at each e ntry into the run mode.

INT I/O Interrupt

0000

First Pass S:1

R6:4 RES

15 R6:5 RES R6:6 RES The following rung tells the DII to look for the presence of a book at the photo-eye and an encoder pulse. By triggering on these two conditions, the DII only counts pulses when there is a book present, otherwise it holds at its existing number of counts. S:49 is the DII PRESET value.

0001

Discrete Input InterruptCompare Value MOV Move Source Dest

Publication 1747-RM001G-EN-P - November 2008

5 5< S:49 0<