Omron CP1E-N@@D@-@ Computer Hardware User Manual


 
2-207
2 Instructions
CP1E CPU Unit Instructions Reference Manual(W483)
Conversion Instructions
2
HEX
Sample program
When CIO 0.00 is ON in the following example, HEX(162) converts the ASCII data in D100 and D101
according to the settings of the digit designator. (Di=#0121 specifies no parity, the starting byte (when
reading) = leftmost byte, the number of bytes to read = 3, and the starting digit (when writing) = digit 1.)
HEX(162) converts three bytes of ASCII data (3 characters) beginning with the leftmost byte of D100
into their hexadecimal equivalents and writes this data to D200 beginning with digit 1.
Parity
It is possible to specify the parity of the ASCII data for use in error control during 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)
Operation of HEX(162)
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 number 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 number of ON bits in each byte. An error will occur if a byte has an
even number of ON bits.
HEX
D100
#0121
D200
0.00
S
Di
D
0347815 12 11
0347815 12 11
Di:#
1210
Di:D200
0123
345
07815
S:D100
D101
33
3435
Number of digits
3 digits
Starting digit (digit 1)
Starting byte
(leftmost byte)