Table Example 3: 8-Bit Independent Variable - Motorola CPU32 Reference Manual

Hide thumbs Also See for CPU32:
Table of Contents

Advertisement

4.6.3 Table Example 3: 8-Bit Independent Variable

Y
This example shows how to use a table instruction within an interpolation subroutine.
Independent variable X is calculated as an 8-bit value, allowing 16 levels of interpola-
tion on a 17-entry table. X is passed to the subroutine, which returns an 8-bit result.
The subroutine uses the following data, based on the function shown in Figure 4-5.
CPU32
REFERENCE MANUAL
1024
2048
INDEPENDENT VARIABLE
Figure 4-5 Table Example 3
X
X
(Subroutine)
(Instruction)
0
0
1
256
2
512
3
768
4
1024
5
1280
6
1536
7
1792
8
2048
9
2304
10
2560
11
2816
12
3072
13
3328
14
3584
15
3840
16
4096
INSTRUCTION SET
3072
4096
X
Y
0
16
32
48
64
80
96
112
128
112
96
80
64
48
32
16
0
MOTOROLA
4-191

Advertisement

Table of Contents
loading

Table of Contents