Rockwell Automation 1772-AF4,D17726.5.3 User Manual, AUX FUNCT PROM User Manual
Page 37
![background image](/manuals/579635/37/background.png)
Programming
Chapter 3
3Ć29
Error Message
If you enter a BCD number larger than 4095, the error bit (bit 14) is set and the
result reads zero.
AF4 Binary to BCD Conversion Function
The AF4 binary to BCD conversion function converts a 12-bit binary number to
a BCD number (from 0 to 4095).
How to Enter an AF4 Binary to BCD Conversion Function
To program an AF4 binary to BCD conversion function, perform the following
steps:
1. Press [SHIFT][EAF]or [SHIFT][SCT] on the keyboard of your industrial
terminal. Figure 3.1 appears on the CRT.
2. Enter 14, the function number for the AF4 binary to BCD conversion.
This entry identifies that the function entered is to perform an AF4 binary to
BCD conversion and that the processor use the data table format shown in
Figure 3.22 when executed.
Figure 3.22
General AF4 Binary to BCD Conversion Function Word and Digit Format
17 16 15 14 13 12 11 10 7 6 5 4 3 2 1 0
S
Digit 1 (MSD)
(Always = 0)
Digit 3
Bit No.
Data Address
Digit 5
S
Result Address
Result
D
E
E = Enable Bit (1 = Function in Progress)
S = Sign Bit (1= Negative)
D = Done Bit (1 = Function Complete)
MSD = Most Significant Digit
LSD = Least Significant Digit
11496
m
n + 1
n
Operand
Digit 4
Digit 6
(LSD)
Digit 2
(Always = 0)
12 Bit Binary Number
3. Enter a data address and a result address.
If we choose a data address of 200 and a result address of 300, the data table
format is as shown in Figure 3.23. Bits 0 through 13 or word 200 are reserved
for the operand (the 12-bit binary number we want to convert to BDD). The
result address, 300, contains the most significant three digits of the resulting
BCD number and the least significant three digits reside in the next higher
address, 301. The first two digits of the BCD number are always zero and the
third digit can not exceed four.