Page 394 - Programmable Logic Controllers, Fifth Edition - Mobile version
P. 394
along with its Monitor Tags window. The operation of the
rung can be summarized as follows: rung along with its Monitor Tags window. When multiple
bottles are packed in cases, the number of bottles per case,
• When the SUB_Sw or Calculate tag is true the SUB the number of cases, and the multiply instruction will give
instruction is executed. you the total number of bottles. The operation of the rung
• Source B (Shipped_Parts) is subtracted from Source can be summarized as follows:
A (Parts_Stock) and the result is stored in the Dest • When the Sw_1 and Sw_2 are both true the MUL
tag named Current_Inventory. instruction is executed.
• In this example, the 200 was subtracted from 900 • Source A (the value in tag Cases_Produced) is
and the result (700) was stored in Current_Inventory. multiplied by Source B (the value in tag Bottles_
• Source A and Source B can be constants (numbers) Per_Case) and the result is stored in the Dest tag
or tags. Bottles_Produced.
The MUL instruction is used to multiply two numbers. • Source A and Source B can be constants (numbers)
Figure 15-80 shows an example of a MUL instruction or tags.
Input Ladder logic program
Sub_Sw
L1
<Local:1:I.Data.4>
SUB
Sub_Sw Subtract
Source A Parts_Stock
Calculate 900
Source B Shipped_Parts
200
Dest Current_Inventory
700
Tag Name Value Style Data Type
Parts_Stock 900 Decimal DINT
Shipped_Parts 200 Decimal DINT
Current_Inventory 700 Decimal DINT
Sub_Sw 1 Decimal BOOL
Calculate 0 Decimal BOOL
Figure 15-79 SUB instruction rung and its Monitor Tags window.
Input Ladder logic program
Sw_1 Sw_2
L1
<Local:1:I.Data.1> <Local:1:I.Data.2>
MUL
Sw_1 Multiply
Source A Cases_Produced
60
Source B Bottles_Per_Case
12
Dest Bottles_Produced
Sw_2 720
Tag Name Value Style Data Type
Sw_1 1 Decimal BOOL
Sw_2 1 Decimal BOOL
Cases_Produced 60 Decimal DINT
Bottles_Per_Case 12 Decimal DINT
Bottles_Produced 720 Decimal DINT
Figure 15-80 MUL instruction rung and its Monitor Tags window.
Math, Comparison, and Move Instructions Part 5 375
pet73842_ch15_333-394.indd 375 03/11/15 7:34 PM