FX Series Programmable Controlers Applied Instructions 5
5-121
5.9.3 ASCI (FNC 82)
Operation:
This instruction reads n hexadecimal data
characters from head source address (S) and
converts them in to the equivalent ASCII code.
This is then stored at the destination (D) for n
number of bytes.
Points to note:
Please note that data is converted ‘as read’, i.e. using the example above with the following
data in (D9,D8) ABCD
H,EF26H. Taking the first n hexadecimal characters (digits) from the right
(in this case n= 6) and converting them to ASCI will store values in 6 consecutive bytes from
D20, i.e. D20 = (67, 68), D21 = (69, 70) and D22 = (50, 54) respectively. In true characters
symbols that would be read as CDEF26.
This can be shown graphically as in the table
to the right. Please take special note that the
source data (S) read from the most significant
device to the least significant. While the
destination data (D) is read in the opposite
direction.
TheASCIinstructioncanbeusedwiththe
M8161, 8 bit/16bit mode flag. The effect of this
flag is exactly the same as that detailed on
page 10-20. The example to the right shows
the effect when M8161 is OFF.
If M8161 was set ON, then only the lower
destination byte (b0-7) would be used to store data and hence 6 data registers would be
required (D20 through D25).
Mnemonic Function
Operands
Program steps
SD n
ASCI
FNC 82
(Converts
HEX to
ASCII)
Converts a data
value from
hexadecimal to
ASCII
K, H, KnX,
KnY,
KnM, KnS
T, C, D, V, Z
KnY, KnM,
KnS
T, C, D
K, H
Note:
n=1to256
)
ASCI,
ASCIP:
7steps
HEX
Character
0123456789ABCDEF
ASCII
Code
HEX 30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 46
DEC 48 49 50 51 52 53 54 55 56 57 65 66 67 68 69 70
Character
Symbol
’0’ ’1’ ’2’ ’3’ ’4’ ’5’ ’6’ ’7’ ’8’ ’9’ ’A’ ’B’ ’C’ ’D’ ’E’ ’F’
FX
1S
FX
1N
FX
2N
FX
2NC
PULSE-P
16 BIT OPERATION
32 BIT OPERATION
X7
K 6
[ S ] [ D ]
D20ASCI D8
[ n ]
Source (S) Data
D9
A
B
C
D
b12-15
b8-11
b4-7
b0-3
D8
E
F
2
6
b12-15
b8-11
b4-7
b0-3
D20
D21
D22
Destination
(D)
HEX DEC
ASCII Code
b8-15
b0-7
b8-15
b0-7
b8-15
b0-7
43
44
45
46
32
36
67
68
69
70
50
54
Symbol
'C'
'D'
'E'
'F'
'2'
'6'
ASCII Character Codes
The table below identifies the usable hexadecimal digits and their associated ASCII codes