14ć20, Binary to bcd – Rockwell Automation 1772-L8_LW_LWP_LX_LXP,D17726.5.8 User Manual User Manual

Page 192

Advertising
background image

EAF Math Instructions

Chapter 14

14-20

Enter the BCD number. Entry of the BCD number 004 095 produces the
hexadecimal number FFF. If the Operand is greater than +32 767, the
result 7FFFh is stored in the data table. However, you will see only FFF
below the instruction. You must use a SEARCH 53 to see the entire word.
If the Operand is more negative than –32 767, 8001 is displayed at the
result address. All negative values are stored as two’s complement.
Figure 14.22 shows how the result is stored in the data table.

Figure 14.22

EAF BCD to Binary Conversion Format in the Data Table After Execution

17 16 15 14

10 7

4 3

Data

Address

0

Result

Address

10359-I

13

040

041

060

0

4

F

0

5

0

9

X

0

0

0

F

F

Operand A

Result

Bit 16 of the first data address word is the sign bit of the BCD number. Bit
17 of the result address is the sign bit of the binary number. Bits 14-16 of
the Result Address word are used if the operand is greater than 4095.

The BCD to Binary EAF function converts a Binary number into a BCD
number. Its function number is 14 and the conversion takes the form:

x xxx = 0yy yyy

Enter an EAF rung like that in Figure 14.23

Figure 14.23

EAF Binary to BCD Conversion Function Input and Display Rung

060

EXECUTE AUX

FUNCTION

FUNCTION NUMBER:

DATA ADDR:

RESULT ADDR:

14

040

060

G

040

G

FFF

004

061

G

095

Binary to BCD

Advertising