Arithmetic instructions
76
Part II IEC Instructions
ATAN
Arctangent
To add an enable input and enable output to the instruction, select [With EN/ENO] from the
"Instructions" pane (LD, FBD or IL editor). To reuse an instruction select "Recently used" from the
context menu or press <Ctrl>+<Shift>+<v> in the programming window.
The number of steps may vary depending on the PLC and parameters used, see
also Table of Code Intensive Instructions in the online help.
PLC types
Availability of ATAN (see page 1318)
Data type I/O Function
REAL input input value between -52707176 and +52707176
REAL output as input arctangent of input value in radians
No. IEC address Set If
R9007 %MX0.900.7 permanently
R9008 %MX0.900.8 for an instant
input variable does not have the data
type REAL or input variable 52707176
R900B %MX0.900.11 permanently output variable is zero
R9009 %MX0.900.9 for an instant processing result overflows the output
variable
In this example, the same POU header is used for all programming languages. For an example
using IL (instruction list), please refer to the online help.
This example uses variables. You can also use a constant for the input variable.
Description
ATAN calculates the arctangent of the input variable (value 52707176) and writes the angle data
in radians into the output variable. The function returns a value greater than -/2 and smaller than
/2.
Data types
Error flags
Example
POU header
All input and output variables used for programming this function have been declared in the POU
header.
Body
The arc tangent of input_value is calculated and written into output_value.
LD
ST
When programming with structured text, enter the following:
output_value:=ATAN(input_value);