beautypg.com

Rockwell Automation 1747-PT1, D1747NP002 Hand-Held Terminal User Manual

Page 293

background image

Chapter 20
Math Instructions

20–17

Example 1 (SLC 5/02 Processors Only)

The BCD value 9760 at source N7:3 is converted from BCD and stored in
N10:0. The maximum source value is 9999, BCD.

9 7 6 0

9 7 6 0

N7:3 4–digit BCD

1001 0111 0110 0000

N10:0 Decimal

0010 0110 0010 0000

F1

F2

F3

F4

F5

ZOOM on FRD –(FRD)– 2.3.0.0.2
NAME: FROM BCD
SOURCE: N7:3 –26784
DEST: N10:0 9760

EDT_DAT

Source is displayed as
–26784, decimal (equivalent
to 9760 BCD).

9

7

6

0

Example 2 (Fixed, SLC 5/01, and SLC 5/02 Processors)

The BCD value 32760 in the math register is converted and stored in N10:0.
The maximum source value is 32767, BCD.

0

0

0

3

2

7

6

0

3 2 7 6 0

0

0

15

15

5–digit BCD

S:14

S:13

0000 0000 0000 0011

0010 0111 0110 0000

N10:0 Decimal

0111 1111 1111 1000

F1

F2

F3

F4

F5

ZOOM on FRD –(FRD)– 2.3.0.0.2
NAME: FROM BCD
DEST: N10:0 32760
SOURCE: S:13 10080

EDT_DAT

Source is displayed as
10080, decimal (equivalent to
32760 BCD).

You should convert BCD values to integer before you manipulate them in
your ladder program. If you do not convert the values, the processor
manipulates them as integer and their value is lost.

Important: If the math register (S:13 and S:14) is used as the source for the

FRD instruction and the BCD value does not exceed 4 digits, be
sure to clear word S:14 before executing the FRD instruction.
If S:14 is not cleared and a value is contained in this word from
another math instruction located elsewhere in the program, an
incorrect decimal value will be placed in the destination word.