Table Example 4: Maintaining Precision - Motorola MC68340 User Manual

Integrated processor with dma
Hide thumbs Also See for MC68340:
Table of Contents

Advertisement

The following value has been calculated for independent variable X:
31
NOT USED
Since X is an 8-bit value, the upper four bits are used as a table offset and the lower four
bits are used as an interpolation fraction. The following results are obtained from the
subroutine:
Thus, Y is calculated as follows:
If the 8-bit value for X were used directly by the table instruction, interpolation would be
incorrectly performed between entries 0 and 1. Data must be shifted to the left four places
before use:
The new range for X is 0
digits of the word with zeros, the interpolation fraction can only have one of 16 values.
After the shift operation, Dx contains the following value:
31
NOT USED
Execution of the table instruction using the new value in Dx yields:
Thus, Y is calculated as follows:
5.3.4.4 TABLE EXAMPLE 4: MAINTAINING PRECISION. In this example, three TBL
operations are performed and the results are summed. The calculation is done once with
the result of each TBL rounded before addition and once with only the final result rounded.
Assume that the result of the three interpolations are as follows (a ".'' indicates the binary
radix point).
5-34
Freescale Semiconductor, Inc.
16
Table Entry Offset
Interpolation Fraction
Y = 80
(13 (64 – 80)) / 16 = 67
LSL.W #4, Dx
X
4096; however, since a left shift fills the least significant
16
Table Entry Offset
Interpolation Fraction
Y = 80
(208 (64 – 80)) / 256 = 67
TBL # 1
TBL# 2
TBL # 3
MC68340 USER'S MANUAL
For More Information On This Product,
Go to: www.freescale.com
15
0
0
0
0
0
0
0
Dx [4:7] = $B = 11
Dx [0:3] = $D = 13
15
0
0
0
0
1
0
1
Dx [8:15] = $0B = 11
Dx [0:7] = $D0 = 208
0010 0000 . 0111 0000
0011 1111 . 0111 0000
0000 0001 . 0111 0000
0
1
0
1
1
1
1
0
1
1
1
0
1
0
0
0
MOTOROLA
0
1
0
0

Advertisement

Table of Contents
loading

Table of Contents