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

Скачать
Страница из 382
FX Series Programmable Controlers
Applied Instructions 5
5-99
5.9.4
HEX (FNC 83)
Operation:
This instruction reads n ASCII data bytes from
head source address (S) and converts them in to
the equivalent Hexadecimal character. This is then
stored at the destination (D) for n number of bytes.
Points to note:
Please note that this instruction ‘works in reverse’ to the ASCI instruction, i.e. ASCII data
stored in bytes is converted into associated hexadecimal characters. The HEX instruction can
be used with the M8161 8bit/16bit flag. In this case the source data (S)is read from either the
lower byte (8bits) when M8161 is ON, or the whole word when M8161 is OFF i.e. using the
example above with the following data in devices D50 and D51 respectively (43
H
,41
H
)
(42
H
,31
H
) and assuming M8161 is ON. 
T h e   A S C I I   d a t a   i s   c o n v e r t e d   t o   i t s
h e x a d e c i m a l   e q u i v a l e n t   a n d   s t o r e d
sequentially digit by digit f r om the destination
head address. 
If M8161 had been OFF, then the contents of
D20 would read CAB1
H
.
Mnemonic
Function 
Operands
Program steps
S
D
n
HEX
FNC 83
(Converts
ASCII to
HEX)
Converts a data
value from ASCII
in to a
hexadecimal
equivalent
K, H, KnX, KnY,
KnM, KnS
T, C, D
KnY, KnM, KnS
T, C, D, V, Z
K, H
Note:
n = 1 to 256
HEX,
HEXP:
7 steps
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
M10
K 4
[ S ]
[ D ]
D20
HEX
D50
[ n ]
Source (S)
 D51
b8-15
b0-7
 D20
Destination
(D)
b12-15
b8-11
b4-7
b0-3
Data
-
-
A
1
HEX
DEC
ASCII Code
43
41
42
31
67
65
66
49
Symbol
'C'
'A'
'B'
'1'
 D50
b8-15
b0-7
For further details regarding the use of the HEX instruction and about the available ASCII data
ranges, please see the following information point ‘ASCII Character Codes’ under the ASCI
instruction on the previous page.
Important:
If an attempt is made to access an ASCII Code (HEX or Decimal) which falls outside of the
ranges specified in the table on previous page, the instruction is not executed. Error 8067 is
flagged in data register D8004 and error 6706 is identified in D8067. Care should be taken
when using the M8161 flag, and additional in the specification of the number of element ‘n‘
which are to be processed as these are the most likely places where this error will be caused.