6F3B0250
168 T1/T1S User’s Manual
7. Instructions

FUN 036 -C Subtraction with carry

Expression
Input -[
A
-C
B
®
C
]- Output
Function
When t he input is O N, the data of
B
and the carry f lag (CF = S050) are subtr acted from
A
, and the
result is stor ed in
C
. If borrow is occurred in the oper at ion, the carry flag is set to ON. I f the result is
great er t han 32767 or smaller than -32768, the output is t urned ON.
This instr uct ion is used to perfor m unsigned subtract ion or double- length subtract ion.
Execution condition
Input Operation Output CF
OFF No execution OFF -
ON Execution Normal No borrow OFF Reset
Borrow occurred OFF Set
Overflow / No borrow ON Reset
underflow Borrow occurred ON Set
Operand
Name Device Re
g
ister Constant Index
X Y R S T. C. XW YW RW SW T C D I J K
A
Minuend ÖÖÖÖÖÖÖÖÖÖ Ö Ö
B
Subtrahend ÖÖÖÖÖÖÖÖÖÖ Ö Ö
C
Difference ÖÖÖÖÖÖÖÖÖ Ö
Example
When R013 is ON, the data of double-length register RW23×RW22 is subtracted from the data of
D0201×D0200, and the result is stored in D0211×D0210. The RST C is a inst r uction to reset t he
carry flag before st arting the calculat ion.
If the data of D0201×D0200 is 12345678 and RW23×RW22 is 12340000, the result 5678 is stored
in D0211×D0210.
D0201×D0200 12345678
-D0211×D0210 5678
RW23×RW22 12340000
CTi Automation - Phone: 800.894.0412 - Fax: 208.368.0415 - Web: www.ctiautomation.net - Email: info@ctiautomation.net