DVP-ES2/EX2/SS2/SA2/SX2/SE&TP Operation Manual - Programming API 83 Operands: S : Source device D : Destination device n : number of bytes to be converted ( n = 1~256) Explanations: 1. 16-bit conversion mode: When M1161 = OFF, the instruction converts n bytes of ASCII codes starting from S into Hex data in byte mode and send them to high byte and low byte of D . n = the converted number of bytes. 2. 8-bit conversion mode: When M1161 = ON, the instruction converts n bytes (low bytes only) of ASCII codes starting from S into Hex data in byte mode and send them to the low byte of D . n = the converted number of bytes. (All higher 8 bits of D = 0) 3.
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: 16-bit conversion. 2. When X0 = ON, convert 4 bytes of ASCII codes stored in registers D20~ D21 into Hex value and send the result in byte mode to register D10. n = 4 M1001 M1161 X0 3. Assume: 3-250 Mnemonic Operands Function Controllers HEX P Convert ASCII to HEX ES2/EX2 SS2 SA2 SX2 SE 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 S SS2 A2 SA2 SE SA2 ES2/EX2 SX2 ES2/EX2 SS2 SX2 ES2/EX2 SS2 SX2 SE SE HEX D20 D10 K4 HEX S HEX S ASCII code ASCII code conversion conversion 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” D22 low byte H 38 “8” D26 low byte H 30 “0” D22 high byte H 39 “9” D26 high byte H 31 “1”