beautypg.com

6ć13, 2 subtract instruction – Rockwell Automation 1772-LP3 PLC - 2/30 Programmable Controller Programming and Operations Manual User Manual

Page 135

background image

Data Manipulation Instructions

Chapter 6

6Ć13

Figure 6.13

Add Instruction

|ą|

11

( + )

1034

111

032

| G |

520

030

| G |

514

031

Must be true to allow

arithmetic operation

Overflow will cause

a 1 to be displayed

Result stored at this

word address

The Subtract instruction tells the processor to subtract the second Get word
value from the first Get word value (Figure 6.14). The difference is then
stored at the data table word addressed by the Subtract instruction.

If the difference is a negative number, the underflow bit of the Subtract
word (bit 16) is set on. In the run, test or run/prog mode, the negative sign
will appear on the industrial terminal screen.

Figure 6.14

Subtract Instruction

|ą|

14

( - )

Ć009

111

042

| G |

100

130

| G |

109

041

Must be true to allow

arithmetic operation

Underflow will cause

negative sign to be

displayed but not used

Result stored at this

word address

NOTE: If a negative BCD value is used for subsequent operations,
inaccurate results will occur. The processor only compares, transfers and
computes the absolute BCD value. In subsequent rungs, the underflow bit
may be examined to determine if an underflow exists.

6.4.2
Subtract Instruction