What Is The Difference In The Way That The BCD ADD WITHOUT CARRY Instruction And BCD ADD WITH CARRY Instructions Are Used? IntroductionThe Carry Flag (CY)! Most PLCs support double-length math instructions, but for example, what should be done if the result of a BCD double-length addition operation exceeds the upper-limit of double-length data, which is 9999 9999? BCD Double-length Data Range 0 to 9999 9999 Now for the Carry Flag (CY)!
Difference between BCD ADD WITHOUT CARRY and BCD ADD WITH CARRY The information from Figure1 and Figure2 is summarized here.
Summary ADD WITHOUT CARRY instruction: 2.About the Number of Digits in Addition Results The ladder program above is capable of handling an addition result of 12 digits in length. However, if the result will exceed 12 digits, make the upper digit calculation instruction a Double Add Instruction, or connecting multiple operations with ADD WITH CARRY Instructions. 3.Addition Operations with Smaller Models The CPM2A Programmable Controllers and other smaller Programmable Controllers only have the ADD WITH CARRY Instruction, so when doing calculations with lower digits, be sure to use the CLEAR CARRY (CLC) instruction to turn OFF the Carry Flag (CY) before executing Addition Instructions. If the Carry Flag (CY) is not property reset, in other steps where the Carry Flag (CY) is turned ON, arithmetic mistakes such as 1 + 1 = 3 will occur. 4.The logic works the same for Binary Addition instructions and other Math Instructions. This document explained the carry procedure as related to the BCD Addition instruction, but the same logic applies to the Binary Addition instructions as well. Link: |
Comments | ||
|