Rockwell Automation 1772-AF4,D17726.5.3 User Manual, AUX FUNCT PROM User Manual

Page 39

Advertising
background image

Programming

Chapter 3

3Ć31

Entry and Display of Input and Result Values

Figure 3.25 shows one method for inserting input values and displaying inputs
and results of an AF4 binary to BCD conversion function. Although there are
other methods for accomplishing this, we chose get instructions. The first rung
requests an AF4 binary to BCD conversion function. The top branch of the
second rung shows the binary number (in the hexadecimal notation FFF) that
we want converted to BCD. In this example, the binary number is the largest
possible, with bits 0 through 13 of word 200 set as shown in figure 3.24. The
lower branch shows the resulting BCD number, 004095, in words 300 and 301.

Figure 3.25

AF4 Binary to BCD Conversion Function Input and Result Display Rungs

200

004

G

300

FFF

G

201

095

G

Bit

Storage

Execute Aux

Function

Function Number:
Data Addr:
Result Addr:

14

200
300

Sign Bits

If you encounter any binary data where the sign bit is not in bit 16, you must
move the sign bit into bit 16 of an auxiliary data table word prior to doing a
binary to BCD conversion. If, for example, the sign bit of your module is bit 15
in word 200, the rungs in Figure 3.26 permit you to make a binary to BCD
conversion. The first rung puts word 200 data into word 201. Rung two sets bit
16 in word 201 if bit 15 in word 200 is set. The AF4 binary to BCD conversion
function in rung three then uses word 201 as its data address.

Advertising