BCD Conversion

BCD, BCDP, DBCD, DBCDP

 

BCD instruction converts a source value to a BCD value and save the BCD value in Destination (assigned device address).

BCD is the Binary Coded Decimal number system that expresses individual decimal digits in a 40bit binary notation.

 

S

Source (Binary data)

D

Destination (BCD value)

 

Instruction

Device address

No. of Steps

Flag

M

X

Y

K

L

F

T

C

S

Z

D

@D

Int.

 

Error

Zero

Carry

BCD(P)

DBCD(P)

S

o

o

o

o

o

o

o

o

-

o

o

o

o

3

o

-

-

D

o

-

o

o

o

-

o

o

-

o

o

o

-

 

Error(F110) : If BCD Data is out of range, Error Flag(F110) will be set.

Instruction

Binary Data range

BCD

BCDP

16bit

0 ~ H270F

0 ~ 9999

DBCD

DBCDP

32bit

0 ~ H05F5E0FF

0 ~ 99999999

 

Example)

If X01 is ON, convert D1(H1111) to BCD value(H4369) and save it to D10