Degrees (DEG)

This table lists the controllers and applications that support this instruction.
Architecture
Standard applications
Safety applications
CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers
Yes
No
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers
Yes
Yes
When enabled, the DEG instruction converts the Source (in radians) to degrees and stores the result in the Destination.
Available Languages
Ladder Diagram
Function Block Diagram
Function Block Diagram supports these elements:
Function Block
FBD Function
TIP:
FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only.
Structured Text
This instruction is not available in structured text.
TIP:
Use DEG 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 structure operand are overwritten.
  • Except when specified, structure operands are shared by multiple instructions.
There are data conversion rules for mixing numeric data types within an instruction. See Data conversions.
Ladder Diagram
Operand
Data Type
CompactLogix
5370,
ControlLogix
5570,
Compact GuardLogix
5370, and
GuardLogix
5570 controllers
Data Type
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers
Format
Description
Source
SINT
INT
DINT
REAL
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
REAL
LREAL
Immediate
tag
Value to convert to degrees
Destination
SINT
INT
DINT
REAL
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
REAL
LREAL
tag
Tag to store the result
Function Block Diagram
FBD Block
Operand
Type
Format
Description
DEG
FBD_MATH_ADVANCED
tag
DEG structure
FBD Function
TIP:
FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only.
Input Operands (Left Pins)
Data Type
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers
Description
Source
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
REAL
LREAL
Value to convert to degrees
Output Operand (Right Pin)
Data Type
CompactLogix
5370,
ControlLogix
5570,
Compact GuardLogix
5370, and
GuardLogix
5570 controllers
Description
Dest
REAL
LREAL
Result of the function
FBD_MATH_ADVANCED Structure
Input Parameter
Data Type
Description
EnableIn
BOOL
Enable input. If false, the instruction does not execute and outputs are not updated.
Default is True.
Source
REAL
Input to the conversion instruction.
Output Parameter
Data Type
Description
EnableOut
BOOL
Indicates if the instruction executed without fault when it was enabled.
Dest
REAL
Result of the instruction.
Description
The DEG instruction uses this algorithm:
Source*180/pi = Source*57.29578
Affects Math Status Flags
Major/Minor Faults
Controllers
Affects Math Status Flags
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers
Conditional, see .
CompactLogix
5370,
ControlLogix
5570,
Compact GuardLogix
5370, and
GuardLogix
5570 controllers
Yes
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 = degree value of the Source.
Postscan
N/A
Function Block Diagram
Function Block
Condition/State
Action Taken
Prescan
N/A
EnableIn is false
Set EnableOut to EnableIn.
EnableIn is true
Dest = degree value of the Source.
If overflow occurs
Clear EnableOut to false
else
Set EnableOut to true.
Instruction first scan
N/A
Instruction first run
N/A
Postscan
N/A
FBD Function
Condition/State
Action Taken
Prescan
N/A
Normal Scan
Dest = DEG(Source)
Instruction first run
N/A
Instruction first scan
N/A
Postscan
N/A
Examples
Ladder Diagram
Function Block Diagram
FBD Block
FBD Function
Structured Text
REAL_dest := DEG(REAL_src);
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.