2 Instructions
2-218 CP1E CPU Unit Instructions Reference Manual(W483)
Special Math Instructions

APR

Applicable Program Areas
Operands

Sine Function

Cosine Function

Instruction Mnemonic Variations Function
code Function
ARITHMETIC PROCESS APR @APR 069 Calculates the sine, cosine, or a linear extrapola-
tion of the source data.
Symbol
APR
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
C Control word UINT Variable
S Source data WORD 1
R Result word WORD 1
Sine Function (C=0000)
When C is 0000, APR(069) calculates the SIN(S) and writes
the result to R. The range for S is 0000 to 0900 BCD (0.0° to
90.0°) and the range for R is 0000 to 9999 BCD (0.0000 to
0.9999). The remainder of the result beyond the fourth deci-
mal place is eliminated.
Cosine Function (C=0001)
When C is 0001, APR(069) calculates the COS(S) and writes
the result to R. The range for S is 0000 to 0900 BCD (0.0° to
90.0°) and the range for R is 0000 to 9999 BCD (0.0000 to
0.9999). The remainder of the result beyond the fourth deci-
mal place is eliminated.
Note The actual result for SIN(90°) and COS(0°) is 1, but 9999 (0.9999) will be output to R.
C: Control word
S: Source word
R: Result word
APR(069)
C
S
R
Operand Value Data range
C 0000 hex ---
S0000 to 0900 (BCD) 0° to 90°
R0000 to 9999 (BCD)
9999 (BCD)
0.0000 to 0.9999
1.0000
Operand Value Data range
C 0001 hex ---
S0000 to 0900 (BCD) 0° to 90°
R0000 to 9999 (BCD)
9999 (BCD)
0.0000 to 0.9999
1.0000