[Instruction] Contents
[Instruction] Contents [Instruction] Contents
Basic Function InstructionFUN 11 D P(+)SymbolADDITION(Performs addition of the data specified at Sa and Sb and stores the result in D)OperandFUN 11 D P(+)Sa: AugendSb: AddendD : Destination register to store the resultsof the additionSa, Sb, D may combine with V, Z, P0~P9to serve indirect addressingRangeOperandWX WY WM WS TMR CTR HR IR OR SR ROR DR K XRWX0∣WX240WY0∣WY240WM0∣WM1896WS0∣WS984T0∣T255C0∣C255R0∣R3839R3840∣R3903R3904∣R3967R3968∣R4167R5000∣R8071D0∣D409516/32-bit+/− numberSa ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○Sb ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○D ○ ○ ○ ○ ○ ○ ○ ○* ○* ○ ○V、ZP0~P9Description●Performs the addition of the data specified at Sa and Sb and writes the results to a specified register Dwhen the add control input "EN" =1 or "EN↑" ( D instruction) from 0 to 1. If the result of addition is equal to0 then set FO0 to 1. If carry occurs (the result exceeds 32767 or 2147483647) then set FO1 to 1. If borrowoccurs (adding negative numbers resulting in a sum less than -32768 or -2147483648), then set the FO2 to1. All the FO statuses are retained until this instruction is executed again and overwritten by a new result.Example16-bit additionLadder Diagram Key Operations Mnemonic CodesX011P.(+)ENU/SSa :Sb :D :RRR012D=0CYY0ORG ORG X 0FUN 11PSa: R 0Sb: R 1BRD: R 2FO 1OUTOUT Y 0Sa R0 12345Sb R1 20425R0+R1=32770 X0=D R2 2 32768+2=32770Y0=1 (carry 1 represents +32768)6-26
Basic Function InstructionFUN 12 D P(−)SymbolSUBTRACTION(Performs subtraction of the data specified at Sa and Sb and stores the result in D)FUN 12 D P(−)OperandSa: MinuendSb: SubtrahendD : Destination register to store theresults of the subtractionSa, Sb, D may combine with V, Z, P0~P9to serve indirect addressingRangeOperandWX WY WM WS TMR CTR HR IR OR SR ROR DR K XRWX0∣WX240WY0∣WY240WM0∣WM1896WS0∣WS984T0∣T255C0∣C255R0∣R3839R3840∣R3903R3904∣R3967R3968∣R4167R5000∣R8071D0∣D409516/32-bit+/− numberSa ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○Sb ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○D ○ ○ ○ ○ ○ ○ ○ ○* ○* ○ ○V、ZP0~P9Description●Performs the subtraction of the data specified at Sa and Sb and writes the results to a specified register Dwhen the subtract control input "EN" =1 or "EN↑" ( P instruction) from 0 to 1. If the result of subtraction isequal to 0 then set FO0 to 1. If carry occurs (subtracting a negative number from a positive number and theresult exceeds 32767 or 2147483647), then set FO1 to 1. If borrow occurs (subtracting a positive numberfrom a negative number and the resulted difference is less than -32768 or -2147483648), then set FO2 to 1.All the FO statuses are retained until this instruction is executed again and overwritten by a new result.Example16-bit subtractionLadder Diagram Key Operations Mnemonic CodesORG ORG X 0X012P.(-)ENU/SSa :Sb :D :RRR012D=0CYBRY2FUN 12Sa: R 0Sb: R 1D: R 2FO 2OUTOUT Y 2Sa R0 -5Sb R1 32767R0-R1=-32772 X0=1D R2 -4 -32768-4=-32772Y2=1(borrow 1 represents-32768)Please refer to section 6.56-27
- Page 44 and 45: FUNNo.NameOperandDerivativeinstruct
- Page 46 and 47: • Ramp Function InstructionsFUNNo
- Page 48 and 49: MEMO
- Page 50 and 51: ※For the relays marked with a ‘
- Page 52 and 53: FUN7 is the UDCTR function. While r
- Page 54 and 55: X0X1Node ANode BIncerseInversediffe
- Page 56 and 57: All input controls of the function
- Page 58 and 59: • The names and functions of the
- Page 60 and 61: 5.1.4 Functions Output (FO)The “F
- Page 62 and 63: Indirect addressing program example
- Page 64 and 65: 5.3.2 The Coding of Numeric Numbers
- Page 66 and 67: (2). 0.5 = (-1) 0 * 2 ( 01111110 )
- Page 68 and 69: While all FBs-PLC numerical operati
- Page 70 and 71: Basic Function InstructionT TIMER T
- Page 72 and 73: Basic Function InstructionT TIMER T
- Page 74 and 75: Basic Function InstructionCCOUNTER(
- Page 76 and 77: Basic Function InstructionSET D PSy
- Page 78 and 79: Basic Function InstructionRST D PSy
- Page 80 and 81: Basic Function InstructionFUN 0MCSy
- Page 82 and 83: Basic Function InstructionFUN 1MCES
- Page 84 and 85: Basic Function InstructionFUN 2SKPS
- Page 86 and 87: Basic Function InstructionFUN 4DIFU
- Page 88 and 89: Basic Function InstructionFUN 6 D P
- Page 90 and 91: Basic Function InstructionFUN 7 DUD
- Page 92 and 93: Basic Function InstructionFUN 9 D P
- Page 96 and 97: Basic Function InstructionFUN 13 D
- Page 98 and 99: Basic Function InstructionFUN 14 D
- Page 100 and 101: Basic Function InstructionFUN 15 D
- Page 102 and 103: Basic Function InstructionFUN 17 D
- Page 104 and 105: Basic Function InstructionFUN 19 D
- Page 106 and 107: Basic Function InstructionFUN 21 D
- Page 108 and 109: Advanced Function InstructionFUN22
- Page 110 and 111: Advanced Function InstructionFUN 24
- Page 112 and 113: Advanced Function InstructionFUN 26
- Page 114 and 115: Advanced Function InstructionFUN 28
- Page 116 and 117: Advanced Function InstructionFUN 30
- Page 118 and 119: Advanced Function InstructionFUN32A
- Page 120 and 121: Advanced Function InstructionFUN 36
- Page 122 and 123: Advanced Function InstructionFUN 40
- Page 124 and 125: Advanced Function InstructionFUN 42
- Page 126 and 127: Advanced Function InstructionFUN 44
- Page 128 and 129: Advanced Function InstructionFUN 46
- Page 130 and 131: Advanced Function InstructionFUN 48
- Page 132 and 133: Advanced Function InstructionFUN50
- Page 134 and 135: Advanced Function InstructionFUN 52
- Page 136 and 137: Advanced Function InstructionFUN 54
- Page 138 and 139: Advanced Function InstructionFUN55
- Page 140 and 141: Advanced Function InstructionFUN56
- Page 142 and 143: Advanced Function InstructionFUN 58
Basic Function <strong>Instruction</strong>FUN 11 D P(+)SymbolADDITION(Performs addition of the data specified at Sa and Sb and stores the result in D)OperandFUN 11 D P(+)Sa: AugendSb: AddendD : Destination register to store the resultsof the additionSa, Sb, D may combine with V, Z, P0~P9to serve indirect addressingRangeOperandWX WY WM WS TMR CTR HR IR OR SR ROR DR K XRWX0∣WX240WY0∣WY240WM0∣WM1896WS0∣WS984T0∣T255C0∣C255R0∣R3839R3840∣R3903R3904∣R3967R3968∣R4167R5000∣R8071D0∣D409516/32-bit+/− numberSa ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○Sb ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○D ○ ○ ○ ○ ○ ○ ○ ○* ○* ○ ○V、ZP0~P9Description●Performs the addition of the data specified at Sa and Sb and writes the results to a specified register Dwhen the add control input "EN" =1 or "EN↑" ( D instruction) from 0 to 1. If the result of addition is equal to0 then set FO0 to 1. If carry occurs (the result exceeds 32767 or 2147483647) then set FO1 to 1. If borrowoccurs (adding negative numbers resulting in a sum less than -32768 or -2147483648), then set the FO2 to1. All the FO statuses are retained until this instruction is executed again and overwritten by a new result.Example16-bit additionLadder Diagram Key Operations Mnemonic CodesX011P.(+)ENU/SSa :Sb :D :RRR012D=0CYY0ORG ORG X 0FUN 11PSa: R 0Sb: R 1BRD: R 2FO 1OUTOUT Y 0Sa R0 12345Sb R1 20425R0+R1=32770 X0=D R2 2 32768+2=32770Y0=1 (carry 1 represents +32768)6-26