CPM2A_PROGRAMMING MANUAL (W353-E1-2) (986750), страница 73
Текст из файла (страница 73)
When theexecution condition is ON, SDEC(78) converts the designated digit(s) of S intothe equivalent 8-bit, 7-segment display code and places it into the destinationword(s) beginning with D.Any or all of the digits in S may be converted in sequence from the designatedfirst digit. The first digit, the number of digits to be converted, and the half of D toreceive the first 7-segment display code (rightmost or leftmost 8 bits) are designated in Di. If multiple digits are designated, they will be placed in order startingfrom the designated half of D, each requiring two digits.
If more digits are designated than remain in S (counting from the designated first digit), further digits willbe used starting back at the beginning of S.Digit DesignatorThe digits of Di are set as shown below.Digit number:3 2 1 0Specifies the first digit of S to be converted (0 to 3).Number of digits to be converted (0 to 3)0: 1 digit1: 2 digits2: 3 digits3: 4 digitsFirst half of D to be used.0: Rightmost 8 bits (1st half)1: Leftmost 8 bits (2nd half)Not used; set to 0.416Section 7-20Conversion InstructionsSome example Di values and the 4-bit binary to 7-segment display conversionsthat they produce are shown below.Di: 0011S digits01Di: 0030DS digitsD1st half01st half2nd half12nd half2233D+11st half2nd halfDi: 0112S digitsD01st half12nd half23D+1Di: 0130S digits0123D1st half2nd halfD+11st half1st half2nd half2nd halfD+21st half2nd half417Section 7-20Conversion InstructionsExampleThe following example shows the data to produce an 8.
The lower case lettersshow which bits correspond to which segments of the 7-segment display. Thetable underneath shows the original data and converted code for all hexadecimal digits.00000@ SDEC(78)DM 0010LR 07200LR 07aIR 200DM 0010f1a11b2201c02301d02001e2101f02201g023102002112210231020102100221023102001210x1000x1010x1020x1031: Second digit00: One digit13Not used.Digit41820 or 1:0 Bits 00 through 071 Bits 08 through 15.Bit 008Bit 07Original dataBits–bgecd0Converted code (segments)gfedcbDisplaya0000000110000100010011000020010001100113001100110011401000011010050101001101016011000110101701110011011181000001110009100100111001A101001000001B101101000010C110001000011D110101000100E111001000101F111101000110Section 7-20Conversion InstructionsFlagsER:Incorrect digit designator, or data area for destination exceeded.Indirectly addressed DM word is non-existent.
(Content of *DM word isnot BCD, or the DM area boundary has been exceeded.)7-20-8 ASCII CONVERT – ASC(86)Operand Data AreasS: Source wordLadder SymbolsIR, SR, AR, DM, HR, TC, LRASC(86)@ASC(86)SSDiDiDDDi: Digit designatorLimitationsIR, SR, AR, DM, HR, TC, LR, #D: First destination wordIR, SR, AR, DM, HR, LRDi 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, ASC(86) is not executed. When theexecution condition is ON, ASC(86) converts the designated digit(s) of S into theequivalent 8-bit ASCII code and places it into the destination word(s) beginningwith D.Any or all of the digits in S may be converted in order from the designated firstdigit.
The first digit, the number of digits to be converted, and the half of D to receive the first ASCII code (rightmost or leftmost 8 bits) are designated in Di. Ifmultiple digits are designated, they will be placed in order starting from the designated half of D, each requiring two digits. If more digits are designated thanremain in S (counting from the designated first digit), further digits will be usedstarting back at the beginning of S.Note Refer to Appendix G for a table of ASCII characters.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 digitsFirst half of D to be used.0: Rightmost 8 bits (1st half)1: Leftmost 8 bits (2nd half)Parity0: none1: even2: odd419Section 7-20Conversion InstructionsSome examples of Di values and the 4-bit binary to 8-bit ASCII conversions thatthey produce are shown below.Di: 0011S01Di: 0030DSD1st half01st half2nd half12nd half2233D+11st half2nd halfDi: 0112SDi: 013001st halfS012nd half1D1st half2nd half223DD+13D+11st half1st half2nd half2nd halfD+21st half2nd halfParityThe leftmost bit of each ASCII character (2 digits) can be automatically adjustedfor either even or odd parity.
If no parity is designated, the leftmost bit will alwaysbe zero.When even parity is designated, the leftmost bit will be adjusted so that the totalnumber of ON bits is even, e.g., when adjusted for even parity, ASCII “31”(00110001) will be “B1” (10110001: parity bit turned ON to create an even number of ON bits); ASCII “36” (00110110) will be “36” (00110110: parity bit turnedOFF because the number of ON bits is already even). The status of the parity bitdoes not affect the meaning of the ASCII code.When odd parity is designated, the leftmost bit of each ASCII character will beadjusted so that there is an odd number of ON bits.FlagsER:Incorrect digit designator, or data area for destination exceeded.Indirectly addressed DM word is non-existent.
(Content of *DM word isnot BCD, or the DM area boundary has been exceeded.)420Section 7-20Conversion Instructions7-20-9 ASCII-TO-HEXADECIMAL – HEX(––)Operand Data AreasS: First source wordLadder SymbolsIR, SR, AR, DM, HR, TC, LR, #HEX(––)@HEX(––)SSDiDiDDDi: Digit designatorLimitationsIR, SR, AR, DM, HR, TC, LR, #D: Destination wordIR, SR, AR, DM, HR, LRThis instruction is available in the CPM2A/CPM2C/SRM1(-V2) only.Di must be within the values given below.All source words must be in the same data area.Bytes in the source words must contain the ASCII code equivalent of hexadecimal values, i.e., 30 to 39 (0 to 9) or 41 to 46 (A to F).DM 6144 to DM 6655 cannot be used for D.DescriptionWhen the execution condition is OFF, HEX(––) is not executed.
When theexecution condition is ON, HEX(––) converts the designated byte(s) of ASCIIcode from the source word(s) into the hexadecimal equivalent and places it intoD.Up to 4 ASCII codes may be converted beginning with the designated first byteof S. The converted hexadecimal values are then placed in D in order from thedesignated digit. The first byte (rightmost or leftmost 8 bits), the number of bytesto be converted, and the digit of D to receive the first hexadecimal value aredesignated in Di. If multiple bytes are designated, they will be converted in orderstarting from the designated half of S and continuing to S+1 and S+2, ifnecessary.If more digits are designated than remain in D (counting from the designated firstdigit), further digits will be used starting back at the beginning of D.
Digits in Dthat do not receive converted data will not be changed.Digit DesignatorThe digits of Di are set as shown below.Digit number:3 2 1 0Specifies the first digit of D to be used (0 to 3).Number of bytes to be converted (0 to 3)0: 1 byte (2-digit ASCII code)1: 2 bytes2: 3 bytes3: 4 bytesFirst byte of S to be used.0: Rightmost 8 bits (1st byte)1: Leftmost 8 bits (2nd byte)Parity0: none1: even2: odd421Section 7-20Conversion InstructionsSome examples of Di values and the 8-bit ASCII to 4-bit hexadecimal conversions that they produce are shown below.Di: 0011Di: 0030DS1st2ndSDbyte01stbyte0byte12ndbyte122S+1331st byte2nd byteDi: 0023Di: 0133SD1st byte01st byteD2nd byte12nd byte0S2S+11S+1321st byte1st byte2nd byte2nd byte3S+21st byte2nd byteASCII Code TableThe following table shows the ASCII codes before conversion and the hexadecimal values after conversion.
Refer to Appendix G for a table of ASCII characters.Original dataASCII CodeConverted dataBit status (See note.)DigitBits30*01100000000031*01100011000132*01100102001033*01100113001134*01101004010035*01101015010136*01101106011037*01101117011138*01110008100039*01110019100141*1010001A101042*1010010B101143*1010011C110044*1010100D110145*1010101E111046*1010110F1111Note The leftmost bit of each ASCII code is adjusted for parity.Parity422The leftmost bit of each ASCII character (2 digits) is automatically adjusted foreither even or odd parity.With no parity, the leftmost bit should always be zero.