Omron CP - PROGRAMMING MANUAL 05-2007 Programming Manual page 446

Cp1h/cp1l cpu unit
Table of Contents

Advertisement

Conversion Instructions
Flags
Di: #0112
Leftmost
Rightmost
Digit 3 Digit 2 Digit 1 Digit 0
Hexadecimal digits (4 bits)
0 to 9
A to F
The following diagram shows the basic operation of HEX(162) with Di=0021.
Di
First byte to convert
Left (1)
Number of digits (n+1)
Parity
It is possible to specify the parity of the ASCII data for use in error control dur-
ing data transmissions. The leftmost bit in each byte is the parity bit. With no
parity the parity bit should always be zero, with even parity the status of the
parity bit should result in an even number of ON bits, and with odd parity the
status of the parity bit should result in an odd number of ON bits.
The following table shows the operation of HEX(162) for each parity setting.
Parity setting
(leftmost digit of Di)
No parity (0)
HEX(162) will be executed only when the parity bit in each
byte is 0. An error will occur if a parity bit is non-zero.
Even parity (1)
HEX(162) will be executed only when there is an even num-
ber of ON bits in each byte. An error will occur if a byte has
an odd number of ON bits.
Odd parity (2)
HEX(162) will be executed only when there is an odd num-
ber of ON bits in each byte. An error will occur if a byte has
an even number of ON bits.
Examples of Di
When two or more bytes are being converted, HEX(162) will write the con-
verted digits to the destination word from right to left and will wrap around to
the rightmost digit if necessary. The following diagram shows some example
values for Di and the conversions that they produce.
Di: #0030
Leftmost
Leftmost
Digit 3 Digit 2 Digit 1 Digit 0
ASCII equivalent (2 hexadecimal digits)
30 to 39
41 to 46
C: 0021
Right (0)
First digit to write
Operation of HEX(162)
Rightmost
Rightmost
Leftmost
Digit 3 Digit 2 Digit 1 Digit 0
D
Section 3-11
Di: #0131
Leftmost
Rightmost
Rightmost
413

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents