[Instruction] Contents

[Instruction] Contents [Instruction] Contents

servotechnica.ru
from servotechnica.ru More from this publisher
13.07.2015 Views

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

Basic Function <strong>Instruction</strong>FUN 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

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!