2-221

2 Instructions
CP1E CPU Unit Instructions Reference Manual(W483)
Special Math Instructions
2
APR
Flags
Function
Operation of the Linear Extrapolation Function

APR(069) processes the input data specified in S with the following equation and the line-segment data

(Xn, Yn) specified in the table beginning at C+1. The result is output to the destination word(s) specified

with D.

1. For S < X0
Converted value = Y0

2. For X0≤ S ≤ Xmax, if Xn < S < Xn+1

Converted value = Yn +[{Yn + 1 - Yn}/{Xn + 1 - Xn}]× {Input data S - Xn}

3. Xmax < S

Converted value = Ymax

Up to 256 endpoints can be stored in the line-segment data table beginning at C+1.

Name Label Operation
Error Flag P_ER •ON if C is a constant greater than 0001.
•ON if C is a word address but the X coordinates are not in ascending order (X1≤ X2≤ ... ≤ Xm).
•ON if C is a word address and bits 9, 11, and 15 of C indicate BCD input, but S is not BCD.
•ON if C is a word address and bit 9 of C indicates floating-point data, but S is a one-word constant.
•ON if C is 0000 or 0001 but S is not BCD between 0000 and 0900.
•OFF in all other cases.
Equals Flag P_EQ •ON if the result is 0.
•OFF in all other cases.
Negative Flag P_N •ON if bit 15 of R is ON.
•OFF in all other cases.
Y0
X0

Y (Binary data)

Ymax
Xmax X (Binary data)
Yn
Yn+1
XnXn+1S
f(S)=
D
Yn+
Y (binary data)
Equation:
Calculation
result
X (binary data)
Input data
Xn+1
-
Xn