EasyManua.ls Logo

FATEK FBs-CB5 - Page 151

FATEK FBs-CB5
348 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Basic Function Instruction
6-26
FUN 11 D P
(+)
ADDITION
(Performs addition of the data specified at Sa and Sb and stores the result in D)
FUN 11 D P
(+)
Symbol
Operand
Sa: Augend
Sb: Addend
D : Destination register to store the results
of the addition
Sa, Sb, D may combine with V, Z, P0~P9
to serve indirect addressing
WX WY WM WS TMR CTR HR IR OR SR ROR DR K XR
Range
Ope-
rand
WX0
∣
WX240
WY0
∣
WY240
WM0
∣
WM1896
WS0
∣
WS984
T0
∣
T255
C0
∣
C255
R0
∣
R3839
R3840
∣
R3903
R3904
∣
R3967
R3968
∣
R4167
R5000
∣
R8071
D0
∣
D4095
16/32-bit
+/− number
V、Z
P0~P9
Sa ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Sb ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
D ○ ○ ○ ○ ○ ○ ○ ○* ○* ○ ○
Description
● Performs the addition of the data specified at Sa and Sb and writes the results to a specified register D
when the add control input "EN" =1 or "EN↑" ( D instruction) from 0 to 1. If the result of addition is equal to
0 then set FO0 to 1. If carry occurs (the result exceeds 32767 or 2147483647) then set FO1 to 1. If borrow
occurs (adding negative numbers resulting in a sum less than -32768 or -2147483648), then set the FO2 to
1. All the FO statuses are retained until this instruction is executed again and overwritten by a new result.
Example 16-bit addition
Ladder Diagram Key Operations Mnemonic Codes
X0
EN
U/S
11P.(+)
Sa :
Sb :
D :
R
R
0
1
2
R
D=0
CY
BR
Y0
OUT
ORG
ORG X 0
FUN 11P
Sa: R 0
Sb: R 1
D: R 2
FO 1
OUT Y 0
Sa R0 12345
Sb R1 20425
R0+R1=32770
Ø
X0=
D R2 2
32768+2=32770
Y0=1 (carry 1 represents +32768)