Mitsubishi — Chapter 7 Application Instructions API 50-88

7 Application Instructions API 50-99 API 83 Operands: S : Start device for source data D : Start device for storing the converted result n : Number of bits to be converted Explanations: 1. Range of n : 1 ~ 256 2. See the specifications of each model for their range of use. 3. Flag: M1161 (8/16 bit mode switch) 4. 16-bit conversion mode: When M1161 = Off, the instruction is in 16-bit conversion mode. ASCII codes of the 8 high bits and 8 low bits of the hex data in S are converted into hex value and sent to D (every 4 bits as a group). n = the number of bits converted into ASCII codes. 5. 8-bit conversion mode: When M1161 = On, the instruction is in 8-bit conversion mode.

Every bit of the hex data in S are converted into ASCII codes and sent to the 8 low bits of D . n = the number of converted bits. (All 8 high bits of D = 0) 6. If the ASCII code is not in the range of H30~H39 (0~9) or is not in the range H41~H46 (A~F), HEX will set M1067, and the conversion of the ASCII code into a hexadecimal value will stop. Program Example 1: 1. M1161 = Off: The 16-bit conversion mode 2. When X0 = On, convert the ASCII codes stored in the registers starting from D20 into hex value and send the result (every 4 bits as a group) to registers starting from D10. n = 4. M1001 M1161 X0 3.

Assume DVP-PLC APPLICATION MANUAL 7-124 Mnemonic Operands Function HEX P Converts ASCII to Hex Type OP Bit Devices Word Devices Program Steps X Y M S K H KnX KnY KnM KnS T C D E F HEX, HEXP: 7 steps S * * * * * * * * * D * * * * * * n * * PULSE 16-bit 32-bit EH3 SV2 EH3 ES EX SS SA SX SC EH SV EH3 SV2 ES EX SS SA S X SC EH SV ES EX SS SA SX SC EH SV SV2 HEX D20 D10 K4 S ASCII code Converted to he x S ASCII code Converted to hex D20 low byte H 43 “C” D24 low byte H 34 “4” D20 high byte H 44 “D” D24 high byte H 35 “5” D21 low byte H 45 “E” D25 low byte H 36 “6” D21 high byte H 46 “F” D25 high byte H 37 “7”