Mitsubishi Electronics FX2C Home Theater Server User Manual


 
FX Series Programmable Controlers Applied Instructions 5
5-98
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 b
y
tes.
Points to note:
Please note that data is converted ‘as read’, i.e. usin
g
the example above with the followin
g
data in (D9,D8) AB
CD
H
,
EF26
H
. Takin
g
the first n hexadecimal characters (di
g
its) from the ri
g
ht
(in this case n= 6) and convertin
g
them to ASCI will store values in 6 consecutive b
y
tes from
D20, i.e. D20 = (67, 68), D21 = (69, 70) and D22 = (50, 54) respectivel
y
. In true characters
s
y
mbols that would be read as
CDEF26
.
This can be shown
g
raphicall
y
as in the table
to the ri
g
ht. Please take special note that the
source data (S) read from the most si
g
nificant
device to the least si
g
nificant. While the
destination data (D) is read in the opposite
direction.
The ASCI instruction can be used with the
M8161, 8 bit/16bit mode fla
g
. The effect of this
fla
g
is exactl
y
the same as that detailed on
pa
g
e 10-20. The example to the ri
g
ht shows
the effect when M8161 is OFF.
If M8161 was set ON, then onl
y
the lower
destination b
y
te (b0-7) would be used to store data and hence 6 data re
g
isters would be
required (D20 throu
g
h 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 = 1 to 256
ASCI,
ASCIP:
7 steps
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’
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 di
g
its and their associated ASCII codes