Example 2 – Rockwell Automation 1761-HHP-B30 MicroLogix 1000 with Hand-Held Programmer (HHP) User Manual

Page 188

Advertising
background image

Chapter 11
Using Data Handling Instructions

11–5

Instruction List

FUN GRAPHIC PARAMETER
CODE SYMBOL MNEMONIC NAME ADDRESS VALUE FORCES
–––– ––––––– –––––––– –––– ––––––– ––––– ––––––
21 |–]/[– LDI S1/15 0

51 –EQU– AND–EQU SRCA N1 0000H
SRCB I0 0000H

101 FRD SRC I0 0000H
DEST N2 0000H

FUN GRAPHIC PARAMETER
CODE SYMBOL MNEMONIC NAME ADDRESS VALUE FORCES
–––– ––––––– –––––––– –––– ––––––– ––––– ––––––
106 MOV SRC I0 0000H
DEST N1 0000H

Example 2

The BCD value 32760 in the math register is converted and stored in N10.
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

S14

S13

0000 0000 0000 0011

0010 0111 0110 0000

N10 Decimal

0111 1111 1111 1000

You should convert BCD values to integer before you manipulate them in
your program. If you do not convert the values, the controller manipulates
them as integers and their value may be lost.

Important: If the math register (S13 and S14) is used as the source for the

FRD instruction and the BCD value does not exceed 4 digits, be
sure to clear word S14 before executing the FRD instruction. If
S14 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.

Clearing S14 before executing the FRD instruction is shown below. When
the input condition I/1 is set (1), a BCD value (transferred from a 4-digit
thumbwheel switch for example) is moved from word N2 into the math
register. Status word S14 is then cleared to make certain that unwanted data
is not present when the FRD instruction is executed.

Advertising