Industrial Automation
Industrial Automation | Europe


Main > Product Type > Automation Systems > PLCs
Minimize Text   Default    Enlarge Text


Can The Same DM Address Be Used For The First And Third, Or Second And Third Operand In A Math Instruction?

As shown in Figure 1, in a differentiated program where processing is completed with a single scan by turning ON the add command bit (CIO 0.00), there is no problem if the first (or second) operand are the same as the third operand but, after processing, the augend data stored in D100 will be deleted.

For easy debugging or software maintenance, it is recommended to use a different DM Area address for the third operand.
Explanation of Figure 1

Initially, the value 123 (BCD) is stored in D100, but when add command bit (CIO 0.00) turns ON, the addition process given below is executing in a single scan, and the value stored in D100 will be changed from 123 to 246.

123 (D100) + 123 (constant) = 246 (D100)

Note:The instruction in Figure 1 will execute each cycle. So when you want to perform the operation A + B = C in realtime when the add command bit (CIO 0.00) is turned ON, the DM address of C must be different from that of A and B. If the same address is used, the result data will be updated as many times as the instruction is scanned causing an incorrect value to be stored in the third operand.

Comments (View All Comments / Add Comment)

Related Articles
No related articles found.
Created 2008-11-04
Modified 2008-11-04
Views 3263


You are not logged in.