Bcd Calculations - Omron SYSMAC C2000H Operation Manual

Hide thumbs Also See for SYSMAC C2000H:
Table of Contents

Advertisement

BCD Calculations

Parity
Flags
5-17

BCD Calculations

158
Some examples of Di values and the 4-bit binary to 8-bit ASCII conversions
that they produce are shown below.
Di: 0011
S
D
0
1st half
1
2nd half
2
3
Di: 0112
S
D
0
1st half
1
2nd half
2
D+1
3
1st half
2nd half
The leftmost bit of each ASCII character (2 digits) can be automatically ad-
justed for either even or odd parity. If no parity is designated, the leftmost bit
will always be zero.
When even parity is designated, the leftmost bit will be adjusted so that the
total number of ON bits is even, e.g., when adjusted for even parity, ASCII
"31" (00110001) will be "B1" (10110001: parity bit turned ON to create an
even number of ON bits); ASCII "36" (00110110) will be "36" (00110110: par-
ity bit turned OFF because the number of ON bits is already even). The sta-
tus of the parity bit does not affect the meaning of the ASCII code.
When odd parity is designated, the leftmost bit of each ASCII character will
be adjusted so that there is an odd number of ON bits.
ER:
Incorrect digit designator, or data area for destination exceeded..
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
The BCD calculation instructions – INC(38), DEC(39), ADD(30), ADDL(54),
SUB(31), SUBL(55), MUL(32), MULL(56), DIV(33), DIVL(57), FDIV(79), and
ROOT(72) – all perform arithmetic operations on BCD data.
For INC(38) and DEC(39) the source and result words are the same. That is,
the content of the source word is overwritten with the instruction result. All
other instructions change only the content of the words in which results are
placed, i.e., the contents of source words are the same before and after exe-
cution of any of the other BCD calculation instructions.
STC(40) and CLC(41), which set and clear the carry flag, are included in this
group because most of the BCD operations make use of the carry flag (CY)
in their results. Binary calculations and shift operations also use CY.
Di: 0030
S
D
0
1st half
1
2nd half
2
D+1
3
1st half
2nd half
Di: 0130
S
D
0
1st half
1
2nd half
2
D+1
3
1st half
2nd half
D+2
1st half
2nd half
Section 5-17

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac c1000h

Table of Contents