Two-Argument Arctangent (ATAN2)

This information applies to the Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers.
The ATAN2 instruction takes the two-argument arc tangent of the Source values and stores the result in the Destination (in radians). The ATAN2 operator/function computes the arc tangent of the Source and returns the FLOAT result. The resulting value in the Destination is greater than or equal to -
p
and less than or equal to
p
(where
p
= 3.141593).
Available Languages
Ladder Diagram
ATAN2_LD_avail_v35
Function Block Diagram
Function Block Diagram supports only the FBD function:
FBD Function
TIP:
FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only.
ATAN2_avail_FBDfunction_v35
Structured Text
This instruction is not available in structured text.
TIP:
Use ATAN2 as an operator in an expression to compute the same result. Refer to Structured Text Syntax for more information on the syntax of expressions and assignments within structured text.
Operands
IMPORTANT: Unexpected operation may occur if:
  • Output tag operands are overwritten.
  • Members of a structured operand are overwritten.
  • Except when specified, structure operands are shared by multiple instructions.
Ladder Diagram
Operand
Data Type
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers
Format
Description
Source Y
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
REAL
LREAL
immediate
tag
Source Y of ATAN2 Input
Source X
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
REAL
LREAL
immediate
tag
Source X of ATAN2 Input
Dest
REAL
LREAL
tag
Tag to store result of the instruction.
Function Block Diagram
FBD Function
Operand
Data Type
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers
Description
Source Y
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
REAL
LREAL
Source Y of ATAN2 Input
Source Y
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
REAL
LREAL
Source X of ATAN2 Input
Output Operand (Right Pin)
Data Type
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers
Description
Dest
REAL
LREAL
Result of the function.
Operator Aspects
The ATAN2 operator can be used in various RLL expressions. Similarly, the ATAN2 function is invoked in Structured Text statements. ATAN2 returns a FLOAT result containing the result of two argument arc tangent of the Source Y and Source X. Depending on the context, this value can then be type converted if appropriate.
Affects Math Status Flags
Controllers
Affects Math Status Flag
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers
Conditional, see Math Status Flags.
Major/Minor Faults
None specific to this instruction. See Index Through Arrays for array-indexing faults.
Execution
Ladder Diagram
Condition/State
Action Taken
Prescan
N/A
Rung-condition-in is false
Set Rung-condition-out to Rung-condition-in.
Rung-condition-in is true
Set Rung-condition-out to Rung-condition-in.
Dest = ATAN2(Source Y, Source X)
Postscan
N/A
Function Block Diagram
FBD Function
Condition/State
Action Taken
Prescan
N/A
Normal Scan
Dest = ATAN2(Source Y, Source X)
Instruction first run
N/A
Instruction first scan
N/A
Postscan
N/A
Examples
Ladder Diagram
ATAN2_LD_example_v35
Function Block Diagram
FBD Function
ATAN2_FBDFunction_example_v35
Structured Text
REAL_dest := ATAN2(REAL_srcY, REAL_srcX);
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.