![background image](http://html1.mh-extra.com/html/omron/sysmac-c200h/sysmac-c200h_operation-manual_742423180.webp)
167
Flags
ER:
Mi and/or Su is not BCD.
Indirectly addressed DM word is non-existent. (Content of
*
DM word
is not BCD, or the DM area boundary has been exceeded.)
CY:
ON when the result is negative, i.e., when Mi is less than Su plus CY.
EQ:
ON when the result is 0.
Caution Be sure to clear the carry flag with CLC(41) before executing SUB(31) if its
previous status is not required, and check the status of CY after doing a sub-
traction with SUB(31). If CY is ON as a result of executing SUB(31) (i.e., if
the result is negative), the result is output as the 10’s complement of the true
answer. To convert the output result to the true value, subtract the value in R
from 0.
When 00002 is ON, the following ladder program clears CY, subtracts the
contents of DM 0100 and CY from the content of 010 and places the result in
HR 20.
If CY is set by executing SUB(31), the result in HR 20 is subtracted from zero
(note that CLC(41) is again required to obtain an accurate result), the result
is placed back in HR 20, and HR 2100 is turned ON to indicate a negative
result.
If CY is not set by executing SUB(31), the result is positive, the second sub-
traction is not performed, and HR 2100 is not turned ON. HR 2100 is pro-
grammed as a self-maintaining bit so that a change in the status of CY will
not turn it OFF when the program is recycled.
In this example, differentiated forms of SUB(31) are used so that the subtrac-
tion operation is performed only once each time 00002 is turned ON. When
another subtraction operation is to be performed, 00002 will need to be
Example
BCD Calculations
Section 5-17
Summary of Contents for SYSMAC C200H
Page 1: ...OPERATION MANUAL C200H CPU01 E 03 E 11 E SYSMAC Programmable Controllers Cat No W130 E1 05 ...
Page 2: ...C200H Programmable Controllers CPU01 E 03 E 11 E Operation Manual Revised June 2003 ...
Page 3: ...iv ...
Page 5: ...vi ...
Page 8: ...TABLE OF CONTENTS ix Glossary 345 Index 363 Revision History 369 ...
Page 342: ...336 Programmer Program Date Page Word Contents Notes Word Contents Notes Data Storage ...
Page 374: ...Cat No W130 E1 05 C200H Programmable Controllers CPU01 E 03 E 11 E OPERATION MANUAL ...