19 bcd conversion (bcd), 1 ) operation, 2 ) format – Yaskawa MP900 Series Ladder Programming Manual User Manual

Page 124: 3 ) programming example

Advertising
background image

5.3 Numeric Operation Instructions

5.3.19 BCD Conversion (BCD)

5-55

Instructions

5

5.3.19 BCD Conversion (BCD)

( 1 ) Operation

The input data is converted from binary data to BCD data and stored in the output data.
If the input data is greater than 9,999, or a negative value, the result will be incorrect.

( 2 ) Format

∗ C and # registers cannot be used.

( 3 ) Programming Example

In the following programming example, the value 1,234 in input data A in MW00000 is converted to BCD and stored
in the output data in MW00001.
MW00000 = 1,234: (1

× 4,096) + (2 × 256) + (3 × 16) + 4 → MW00001 = 4,660 (1234 hex)

When performing operations with different data types, the result of the operation will depend on the data type of the output reg-
ister.
Refer to 4.4.2 ( 3 ) Precautions When Using Local Registers within a User Function for details.

Output data

Input data

Converted to BCD.

The output data is computed as shown below when the input decimal data is abcd.

Output data = (a × 49) + (b × 256) + (c × 16) + d

Input data

Output data

Icon:

Key entry: BCD

Parameter Name

Applicable Data Types

B

W

L

F

A

Index

Constant

Input data (Src)

×

{

{

×

×

{

{

Output data (Dest)

×

{

*

{

*

×

×

{

×

INFO

Advertising
This manual is related to the following products: