Справочник Пользователя для Mitsubishi Electronics FX2NC

Скачать
Страница из 382
FX Series Programmable Controlers
Applied Instructions 5
5-98
5.9.3
ASCI (FNC 82)
Operation:
T h i s  i n s t r u c t i on   r e a d s   n   h e x a d ec i m a l   d a t a
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
,EF26
H
. 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.
The ASCI instruction can be used with the
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
S
D
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
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
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
0(S)
FX
0N
FX FX
(2C)
FX
2N(C)
FX
(2C)
FX
FX
2N(C)
FX
0N
FX
0(s)
PULSE-P
FX
(2C)
FX
FX
2N(C)
FX
0N
FX
0(s)
16 BIT OPERATION
FX
FX
0N
FX
0(s)
FX
(2C)
FX
2N(C)
32 BIT OPERATION
X7
K 6
[ S ]
[ D ]
D20
ASCI
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