CPM2A_PROGRAMMING MANUAL (W353-E1-2) (986750), страница 72
Текст из файла (страница 72)
Only the content of R ischanged; the content of S is left unchanged.BinarySBCDRBCD(24) can be used to convert binary to BCD so that displays on the Programming Console or any other programming device will appear in decimal ratherthan hexadecimal. It can also be used to convert to BCD to perform BCD arithmetic operations rather than binary arithmetic operations, e.g., when BCD andbinary values must be added.FlagsER:Indirectly addressed DM word is non-existent. (Content of *DM word isnot BCD, or the DM area boundary has been exceeded.)EQ:ON when the result is zero.7-20-3 DOUBLE BCD-TO-DOUBLE BINARY – BINL(58)Ladder SymbolsOperand Data AreasS: First source word (BCD)BINL(58)@BINL(58)SSRRIR, SR, AR, DM, HR, TC, LRR: First result wordLimitations410IR, SR, AR, DM, HR, LRThis instruction is available in the CPM2A/CPM2C only.Section 7-20Conversion InstructionsDM 6144 to DM 6655 cannot be used for R.DescriptionFlagsWhen the execution condition is OFF, BINL(58) is not executed. When theexecution condition is ON, BINL(58) converts an eight-digit number in S and S+1into 32-bit binary data, and outputs the converted data to R and R+1.ER:BCDS+1SBinaryR+1RThe contents of S and/or S+1 words are not BCD.Indirectly addressed DM word is non-existent.
(Content of *DM word isnot BCD, or the DM area boundary has been exceeded.)EQ:ON when the result is zero.7-20-4 DOUBLE BINARY-TO-DOUBLE BCD – BCDL(59)Ladder SymbolsOperand Data AreasS: First source word (binary)BCDL(59)@BCDL(59)SSRRIR, SR, AR, DM, HR, LRR: First result wordLimitationsIR, SR, AR, DM, HR, LRThis instruction is available in the CPM2A/CPM2C only.If the content of S exceeds 05F5E0FF, the converted result would exceed99999999 and BCDL(59) will not be executed. When the instruction is notexecuted, the content of R and R+1 remain unchanged.DM 6144 to DM 6655 cannot be used for R.DescriptionFlagsBCDL(59) converts the 32-bit binary content of S and S+1 into eight digits ofBCD data, and outputs the converted data to R and R+1.ER:BinaryS+1SBCDR+1RContent of R and R+1 exceeds 99999999.Indirectly addressed DM word is non-existent.
(Content of *DM word isnot BCD, or the DM area boundary has been exceeded.)EQ:ON when the result is zero.411Section 7-20Conversion Instructions7-20-5 4-TO-16 DECODER – MLPX(76)Operand Data AreasS: Source wordLadder SymbolsIR, SR, AR, DM, HR, TC, LRMLPX(76)@MLPX(76)SSDiDiRRDi: Digit designatorIR, SR, AR, DM, HR, TC, LR, #R: First result wordIR, SR, AR, DM, HR, LRLimitationsThe rightmost two digits of Di must each be between 0 and 3.All result words must be in the same data area.DM 6144 to DM 6655 cannot be used for R.DescriptionWhen the execution condition is OFF, MLPX(76) is not executed. When theexecution condition is ON, MLPX(76) converts up to four, four-bit hexadecimaldigits from S into decimal values from 0 to 15, each of which is used to indicate abit position.
The bit whose number corresponds to each converted value is thenturned ON in a result word. If more than one digit is specified, then one bit will beturned ON in each of consecutive words beginning with R. (See examples, below.)The following is an example of a one-digit decode operation from digit number 1of S, i.e., here Di would be 0001.Source wordCBit C (i.e., bit number 12) turned ON.First result word0001000000000000The first digit and the number of digits to be converted are designated in Di. Ifmore digits are designated than remain in S (counting from the designated firstdigit), the remaining digits will be taken starting back at the beginning of S. Thefinal word required to store the converted result (R plus the number of digits to beconverted) must be in the same data area as R, e.g., if two digits are converted,the last word address in a data area cannot be designated; if three digits are converted, the last two words in a data area cannot be designated.Digit DesignatorThe digits of Di are set as shown below.Digit number:3 2 1 0Specifies the first digit to be converted (0 to 3)Number of digits to be converted (0 to 3)0: 1 digit1: 2 digits2: 3 digits3: 4 digitsNot used (Set to zero)412Section 7-20Conversion InstructionsSome example Di values and the digit-to-word conversions that they produceare shown below.Di: 0010Di: 0030SS0R0R1R+11R+122R+233R+3Di: 0031Di: 0023SSR0FlagsER:0R1R+11R+12R+22R+23R+33Undefined digit designator, or R plus number of digits exceeds a dataarea.Indirectly addressed DM word is non-existent.
(Content of *DM word isnot BCD or the DM area boundary has been exceeded.)ExampleThe following program converts digits 1 to 3 of data from DM 0020 to bit positionsand turns ON the corresponding bits in three consecutive words starting with HR10. Digit 0 is not converted.00000MLPX(76)AddressInstructionDM 00200000000001LDMLPX(76)#0021DM 0020DM 0020DM 0020DM 0020DM 0020DM 0020DM 0020DM 0020DM 0020DM 0020DM 0020DM 0020DM 0020DM 0020DM 0020DM 002000010203040506070809101112131415R: HR 10NotConverted1111011000001560HR 1000HR 1001HR 1002HR 1003HR 1004HR 1005HR 1006HR 1007HR 1008HR 1009HR 1010HR 1011HR 1012HR 1013HR 1014HR 1015R+1: HR 11000000000000000100000DM#HRHR 10S: DM 0020OperandsHR 1100HR 1101HR 1102HR 1103HR 1104HR 1105HR 1106HR 1107HR 1108HR 1109HR 1110HR 1111HR 1112HR 1113HR 1114HR 11150020002110R+2: HR 120000001000000000HR 1200HR 1201HR 1202HR 1203HR 1204HR 1205HR 1206HR 1207HR 1208HR 1209HR 1210HR 1211HR 1212HR 1213HR 1214HR 12151000000000000000413Section 7-20Conversion Instructions7-20-6 16-TO-4 ENCODER – DMPX(77)Operand Data AreasSB: First source wordLadder SymbolsIR, SR, AR, DM, HR, TC, LRDMPX(77)@DMPX(77)SBSBRRDiDiR: Result wordLimitationsIR, SR, AR, DM, HR, LRDi: Digit designatorIR, SR, AR, DM, HR, TC, LR, #The rightmost two digits of Di must each be between 0 and 3.All source words must be in the same data area.DM 6144 to DM 6655 cannot be used for SB, R, or Di.DescriptionWhen the execution condition is OFF, DMPX(77) is not executed.
When theexecution condition is ON, DMPX(77) determines the position of the highest ONbit in S, encodes it into single-digit hexadecimal value corresponding to the bitnumber of the highest ON bit number, then transfers the hexadecimal value tothe specified digit in R. The digits to receive the results are specified in Di, whichalso specifies the number of digits to be encoded.The following is an example of a one-digit encode operation to digit number 1 ofR, i.e., here Di would be 0001.First source word0001000100010110C transferred to indicate bit number 12 asthe highest ON bit.Result wordCUp to four digits from four consecutive source words starting with S may be encoded and the digits written to R in order from the designated first digit.
If moredigits are designated than remain in R (counting from the designated first digit),the remaining digits will be placed at digits starting back at the beginning of R.The final word to be converted (S plus the number of digits to be converted) mustbe in the same data area as SB.Digit DesignatorThe digits of Di are set as shown below.Digit numbers: 3 2 1 0Specifies the first digit to receive converted data (0 to 3).Number of words to be converted (0 to 3)0: 1 word1: 2 words2: 3 words3: 4 wordsNot used.414Section 7-20Conversion InstructionsSome example Di values and the word-to-digit conversions that they produceare shown below.Di: 0011Di: 0030RRS0S0S+11S+112S+223S+33Di: 0013Di: 0032RFlagsER:S0SR0S+11S+112S+223S+33Undefined digit designator, or S plus number of digits exceeds a dataarea.Content of a source word is zero.Indirectly addressed DM word is non-existent.
(Content of *DM word isnot BCD, or the DM area boundary has been exceeded.)When 00000 is ON, the following diagram encodes IR words 200 and 201 to thefirst two digits of HR 10 and then encodes LR 10 and 11 to the last two digits ofHR 10. Although the status of each source word bit is not shown, it is assumedthat the bit with status 1 (ON) shown is the highest bit that is ON in the word.Example00000DMPX(77)AddressInstruction2000000000001LDDMPX(77)HR 10Operands00000HR#200100010LRHR#10100012#0010DMPX(77)00002LR 10HR 10#0012IR 200IR 2010100001100:DMPX(77):010111011091010120011100: ::: ::010150011150HR 10LR 11LR 10LR 1100LR 1000LR 1001 1:LR 1002 0LR 1108 1: ::LR 1109 0: ::LR 1015 0: :Digit 0BDigit 19Digit 21Digit 38:LR 1115 0415Section 7-20Conversion Instructions7-20-7 7-SEGMENT DECODER – SDEC(78)Operand Data AreasS: Source word (binary)Ladder SymbolsIR, SR, AR, DM, HR, TC, LRSDEC(78)@SDEC(78)SSDiDiDDDi: Digit designatorIR, SR, AR, DM, HR, TC, LR, #D: First destination wordIR, SR, AR, DM, HR, LRLimitationsDi must be within the values given below.All destination words must be in the same data area.DM 6144 to DM 6655 cannot be used for D.DescriptionWhen the execution condition is OFF, SDEC(78) is not executed.