Jump to External Routine (JXR)

This information applies to the
SoftLogix
5800 controller only.
The JXR instruction executes an external routine.
Available Languages
Ladder Diagram
JXR_LD_avail_v31
Function Block
This instruction is not available for function block.
Structured Text
This instruction is not available for structured text.
Operands
Ladder Diagram
Operand
Type
Format
Description
External routine name
ROUTINE
Name
External routine to execute
External routine control
EXT_ROUTINE_CONTROL
Tag
Control structure
Parameter
BOOL
SINT
INT
DINT
REAL
structure
Immediate
Tag
Array tag
Data from this routine that you want to copy to a variable in the external routine
Parameters are optional.
Enter multiple parameters, if needed.
You can have as many as 10 parameters.
Return parameter
BOOL
SINT
INT
DINT
REAL
Tag
Tag in this routine to which you want to copy a result of the external routine
The return parameter is optional.
You can have only one return parameter
EXT_ROUTINE_CONTROL Structure
Mnemonic
Data Type
Description
Implementation
ErrorCode
SINT
If an error occurs, this value identifies the error. Valid values are from 0-255.
There are no predefined error codes. The developer of the external routine must provide the error codes.
NumParams
SINT
This value indicates the number of parameters associated with this instruction.
Display only - this information is derived from the instruction entry.
ParameterDefs
EXT_ROUTINE_ PARAMETERS[10]
This array contains definitions of the parameters to pass to the external routine. The instruction can pass as many as 10 parameters.
Display only - this information is derived from the instruction entry.
ReturnParamDef
EXT_ROUTIN_ PARAMETERS
This value contains definitions of the return parameter from the external routine. There is only one return parameter.
Display only - this information is derived from the instruction entry.
EN
BOOL
When set, the enable bit indicates that the JXR instruction is enabled.
The external routine sets this bit.
ReturnsValue
BOOL
If set, this bit indicates that a return parameter was entered for the instruction. If cleared, this bit indicates that no return parameter was entered for the instruction.
Display only - this information is derived from the instruction entry.
DN
BOOL
The done bit is set when the external routine has executed once to completion.
The external routine sets this bit.
ER
BOOL
The error bit is set if an error occurs. The instruction stops executing until the program clears the error bit.
The external routine sets this bit.
FirstScan
BOOL
This bit identifies whether this is the first scan after switching the controller to Run mode. Use FirstScan to initialize the external routine, if needed.
The controller sets this bit to reflect scan status.
EnableOut
BOOL
Enable output.
The external routine sets this bit.
EnableIn
BOOL
Enable input.
The controller sets this bit to reflect rung-condition-in. The instruction executes regardless of rung condition. The developer of the external routine should monitor this status and act accordingly.
User1
BOOL
These bits are available for the user. The controller does not initialize these bits.
Either the external routine or the user program can set these bits.
User0
BOOL
ScanType1
BOOL
These bits identify the current scan type:
Bit Values
Scan Type
00
Normal
01
Pre Scan
10
Post Scan (not applicable to relay ladder programs)
The controller sets these bits to reflect scan status.
ScanType0
BOOL
Description
Use the Jump to External Routine (JXR) instruction to call the external routine from a ladder routine in your project. The JXR instruction supports multiple parameters so you can pass values between the ladder routine and the external routine.
The JXR instruction is similar to the Jump to Subroutine ( JSR) instruction. The JXR instruction initiates the execution of the specified external routine:
  • The external routine executes one time.
  • After the external routine executes, logic execution returns to the routine that contains the JXR instruction.
Affects Math Status Flags
No
Major/Minor Faults
A major fault will occur if
Fault Type
Fault Code:
An exception occurs in the external routine DLL.
The DLL could not be loaded.
The entry point was not found in the DLL.
4
88
Execution
The JXR can be synchronous or asynchronous depending on the implementation of the DLL. The code in the DLL also determines how to respond to scan status, rung-condition-in status, and rung-condition-out status.
For more information on using the JXR instruction and creating external routines, see thehttps://literature.rockwellautomation.com/idc/groups/literature/documents/um/1789-um002_-en-p.pdf.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.