Limit (LIMIT)
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 |
The LIMIT instruction tests if the Test value is within the range of the Low and High Limits as indicated in the LIMIT Flow Chart (True).
TIP:
In Logix Designer version 36, the mnemonic for this instruction changed from LIM to LIMIT.
If any operand is Not A Number (NAN), the .EnableOut is cleared to false.
Available Languages
Ladder Diagram
Function Block Diagram
Function Block Diagram supports these elements:
FBD 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.
Operands
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 |
---|---|---|---|---|
Low Limit | SINT INT DINT REAL | SINT INT DINT LINT USINT UINT UDINT ULINT REAL LREAL | immediate tag | Value of lower limit. |
Test | SINT INT DINT REAL | SINT INT DINT LINT USINT UINT UDINT ULINT REAL LREAL | immediate tag | Value to test against limits. |
High Limit | SINT INT DINT REAL | SINT INT DINT LINT USINT UINT UDINT ULINT REAL LREAL | immediate tag | Value of upper limit. |
Function Block Diagram
FBD Block
Operand | Data Type | Format | Description |
---|---|---|---|
LIMIT | FBD_LIMIT | tag | LIMIT structure |
FBD_LIMIT Structure
Input Members | Data Type | Description |
---|---|---|
EnableIn | BOOL | Enable input. If false, the instruction does not execute and outputs are not updated.
Default is true. |
LowLimit | REAL | Value of lower limit. |
Test | REAL | Value to test against limits. |
HighLimit | REAL | Value of upper limit. |
Output Members | Data Type | Description |
---|---|---|
EnableOut | BOOL | Indicates if the instruction is enabled. |
Dest | BOOL | Set to true if Limit test is true. Cleared to false if Limit test is false. |
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 |
---|---|---|
Low Limit | SINT INT DINT LINT USINT UINT UDINT ULINT REAL LREAL | Value of lower limit |
Test | SINT INT DINT LINT USINT UINT UDINT ULINT REAL LREAL | Value to test against limits. |
High Limit | SINT INT DINT LINT USINT UINT UDINT ULINT REAL LREAL | Value of upper limit. |
Output Operand (Right Pin) | Data Type | Description |
---|---|---|
Dest | BOOL | Set to true if Limit test is true. Cleared to false if Limit test is false. |
See FBD Functions.
Operation
This section illustrates the operation for the LIMIT instruction.
If Low Limit: | And if the test value is: | Then the EnableOut is: |
---|---|---|
< or = to High Limit | equal to or between limits
not equal to or outside limits | true
false |
> High Limit | equal to or outside limits
not equal to or inside limits | true
false |
Signed integers transition from the maximum positive number to the maximum negative number when the most significant bit is true. For example, in 16-bit integers (INT type), the maximum positive integer is 32,767, which is represented in hexadecimal as 16#7FFF (bits 0 through 14 are all true). If that number increments by one, the result is 16#8000 (bit 15 is true). For signed integers, hexadecimal 16#8000 is equal to -32,768 decimal. Incrementing from this point on until all 16 bits are set ends up at 16#FFFF, which is equal to -1 decimal.
This can be shown as a circular number line. The LIMIT instruction starts at the Low Limit and increments clockwise until it reaches the High Limit. Any Test value in the clockwise range from the Low Limit to the High Limit sets the EnableOut to true. Any Test value in the clockwise range from the High Limit to the Low Limit clears the EnableOut to false.
If any operand is Not A Number (NAN), the .EnableOut is cleared to false.
Affects Math Status Flags
No
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 | See LIMIT Flow Chart (True) If output is true Set Rung-condition-out to true. else Clear Rung-condition-out to false. |
Postscan | N/A |
Function Block Diagram
FBD Block
Condition/State | Action Taken |
---|---|
Prescan | N/A |
EnableIn is false | Set EnableOut to EnableIn. |
EnableIn is true | Set EnableOut to EnableIn.
See LIM Flow Chart (True)
Dest = output |
Instruction first run | N/A |
Instruction first scan | N/A |
Postscan | N/A |
FBD Function
TIP:
FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only.
Condition/State | Action Taken |
---|---|
Prescan | N/A |
Normal Scan | See LIMIT Flow Chart (True) Dest = output |
Instruction first run | N/A |
Instruction first scan | N/A |
Postscan | N/A |
LIMIT Flow Chart (True)
Examples
Example 1: Low Limit <= High Limit
When Test value is equal to or greater than Low Limit, and Test value is less than or equal to High Limit, light_1 is set.
Ladder Diagram
Function Block Diagram
FBD Block
FBD Function
Example 2: Low Limit > High Limit
When value > or = to 0 or value < or = to -100, set light_1 to true. If value < 0 and value > -100, clear light_1 to false.
Ladder Diagram
Function Block Diagram
FBD Block
FBD Function
Provide Feedback