Motion Run Hookup Diagnostics (MRHD)

This information applies to the
CompactLogix
5370,
ControlLogix
5570,
Compact GuardLogix
5370,
GuardLogix
5570,
Compact GuardLogix
5380,
CompactLogix
5380,
CompactLogix
5480,
ControlLogix
5580, and
GuardLogix
5580 controllers. Controller differences are noted where applicable.
Use the Motion Run Hookup Diagnostics (MRHD) instruction to command the motion module to run any one of three different diagnostics on the specified axis as selected by the Diagnostic Test. Currently diagnostics are available to test the motor/encoder hookup for a servo axis, the encoder hookup, and the encoder marker hookup. Commutation Test is also available but only on an AXIS_CIP_DRIVE axis. Only the motor/encoder diagnostic initiates motion on the axis. This action consists of a short move of a user Motor Encoder Test Increment. The move is initiated by roughly 1 Volt per second ramping level of the servo’s drive output. The result of executing the MRHD instruction is that the parameters, Test Status and Test Direction Forward are updated.
  • This is a transitional instruction. Follow these steps when using it:
    • In ladder logic, insert an instruction to toggle the rung-condition-in from false to true each time the instruction should execute.
    • In a Structured Text routine, insert a condition for the instruction to cause it to execute only on a transition.
Available Languages
Ladder Diagram
MRHD_LD_avail_v31
Function Block
This instruction is not available in function block.
Structured Text
MRHD(Axis,MotionControl,DiagnosticTest);
Operands
There are data conversion rules for mixed data types within an instruction. See Data Conversion.
Ladder Diagram and Structured Text
Operand
Type
CompactLogix
5370,
Compact GuardLogix
5370,
Compact GuardLogix
5380,
CompactLogix
5380,
CompactLogix
5480
Type
ControlLogix
5570,
GuardLogix
5570,
ControlLogix
5580, and
GuardLogix
5580 controllers
Format
Description
Axis
AXIS_CIP_DRIVE
AXIS_CIP_DRIVE
AXIS_SERVO
AXIS_SERVO_DRIVE
REF_TO_AXIS_CIP_DRIVE
REF_TO_AXIS_SERVO
REF_TO_AXIS_SERVO_DRIVE
Tag
Name of the axis on which to perform the operation. For controllers that support the REF_TO motion data types, the supported axis operand type can be replaced by an equivalent REF_TO type.
Motion Control
MOTION_INSTRUCTION
MOTION_INSTRUCTION
Tag
Structure used to access instruction status parameters.
Diagnostic test
DINT
DINT
Immediate
Selects the specific test for the motion module to run:
0 = motor/encoder hookup test
1 = encoder hookup test
2 = encoder marker test
3=commutation test
See Structured Text Syntax for more information on the syntax of expressions within structured text.
For the operands that require you to select from available options, enter your selection as:
This Operand
Has These Options Which You
Enter as Text
Or Enter as a Number
DiagnosticTest
motor_encoder
encoder
marker
commutation
0
1
2
3
MOTION_INSTRUCTION Structure
Mnemonic
Description
.EN (Enable) Bit 31
It is set when the rung makes a false-to-true transition and remains set until the servo message transaction is completed and the rung goes false.
.DN (Done) Bit 29
It is set after the hookup test apply process has been successfully executed.
.ER (Error) Bit 28
It is set to indicate that the instruction detected an error, such as if you specified an unconfigured axis.
.IP (In Process) Bit 26
It is set on positive rung transition and cleared after the diagnostic test process is complete, or terminated by a stop command, shutdown, or a servo fault.
.PC (Process Complete)Bit 27
It is set after the diagnostic test process has been successfully completed.
Description - AXIS_SERVO, AXIS_SERVO_DRIVE
The MRHD instruction is used to execute various test diagnostics on the specified axis to test the integrity and, in some cases, the polarity of servo field connections. There are currently test diagnostics supporting drive hookup, encoder hookup, marker hookup and motion module OK contact hookup. Test for Commutation also available when using Axis_CIP_Drive. During some of these test processes the motion module generates output to the external drive to produce a small amount of motion. Measurements made during some of these hookup diagnostic tests are saved as output configuration parameters that also serve as input data for a subsequent MAHD (Motion Apply Hookup Diagnostic) instruction. MRHD requires only one explicit input parameter, Diagnostic Test. Enter or select the Diagnostic Test to run and the axis to test.
If the targeted axis does not appear in the list of available axes, the axis has not been configured for operation. Use the Tag Editor to create and configure a new axis.
The MRHD instruction uses axis configuration parameters as input and output. The input configuration parameters that MRHD uses are shown in this table.
Axis Parameter
Data Type
Units
Meaning
Motor Encoder Test Increment
Real
-
Distance that the Axis must travel to satisfy the Hookup Diagnostic Test.
The axis configuration parameters that MRHD generates as output depend on the specified Hookup Diagnostic.
Motor Encoder Hookup Test
If the Motor Encoder Test is selected, the motion module enables the external drive and generates a 1 Volt per second output ramp to the drive while monitoring the encoder feedback. When the axis has moved a distance greater than or equal to the configured Motor Encoder Test Increment, the test voltage is set back to zero and the drive disabled. The motion module then reports the direction of travel which is stored as one of these output parameters:
Axis Parameter
Data Type
Units
Meaning
Test Status
Integer
-
Status Report of the Hookup Diagnostic Test Process.
Test Direction Forward
Boolean
-
Direction of axis travel during hookup test as seen by the motion module.
If due to improper hookup, or some other problem with the system, the axis feedback fails to detect that axis reaching the configured Motor Encoder Test Increment within 2 seconds, the servo sets the test voltage back to zero and disables the drive. The control reflects this condition through the Test Status axis output parameter. This usually indicates that either the cabling to the drive or the cabling to the encoder is incorrect. Running MRHD with the Encoder Hookup Test selected is an effective method of isolating the problem to the encoder or drive.
Encoder Hookup Test
If the Encoder Test is selected, the motion module does not generate any axis motion, but simply monitors axis encoder feedback. The axis can then be moved by hand or by some other independent drive actuator to generate motion. When the motion module detects that the axis has moved a distance greater than or equal to the configured Motor Encoder Test Increment, the test is complete. The motion module then reports the direction of travel as one of the following MRHD output parameters.
Axis Parameter
Data Type
Units
Meaning
Test Status
Integer
-
Status Report of the Hookup Diagnostic Test Process.
Test Direction Forward
Boolean
-
Direction of axis travel during hookup test as seen by the motion module.
If due to improper hookup, or some other problem with the system, the axis feedback fails to detect the axis reaching the configured Motor Encoder Test Increment after moving the axis at least that distance, then abort the test using the MAS instruction and check the encoder wiring.
Marker Hookup Test
If the Marker Test is selected, the motion module does not generate any axis motion, but simply monitors axis encoder feedback. The axis can then be moved by hand or by some other independent drive actuator to generate motion. When the motion module detects a marker (Channel Z) pulse, the test is then complete. The motion module then reports success via the Test Status.
Axis Parameter
Data Type
Units
Meaning
Test Status
Integer
-
Status Report of the Hookup Diagnostic Test Process.
Test Direction Forward
Boolean
-
Direction of axis travel during hookup test as seen by the motion module.
If due to improper hookup, or some other problem with the system, the axis feedback fails to detect that axis reaching the configured Motor Encoder Test Increment after moving the axis at least that distance, then abort the test using the MAS instruction and check the encoder wiring.
Test Status
Conditions may occur that make it impossible for the control to properly perform the test operation. When this is the case, the test process is automatically aborted and a test fault is reported and stored in the Test Status output parameter. It is also possible to manually abort a test process using a MAS instruction which results in a test fault reported by the Test Status parameter. Possible values for Test Status are shown in the table below:
Error Message
Code
Definition
Test Success
0
Test Process has been successful.
Test In Process
1
Test is in progress.
Test Aborted
2
Test Process was aborted by user.
Test Time-out
3
Test Process has exceeded timed out (2 seconds).
Test Servo Fault
4
Test Process Failed due to Servo Fault.
Test Increment Fault
5
Test Process Failed due to insufficient test increment distance to make a reliable measure.
To successfully execute a MRHD instruction running the Motor Encoder Test, the targeted axis must be configured as a Servo Axis Type and the axis must be in the Axis Ready state. For other tests this instruction executes properly on either a Servo or Feedback Only axis type. If any of these conditions are not met than the instruction errs.
IMPORTANT:
When the MRHD instruction is initially executed the In process (.IP) bit is set and the Process Complete (.PC) bit is cleared. The MRHD instruction execution can take multiple scans to execute because it requires transmission of multiple messages to the motion module. The Done (.DN) bit, is not set immediately, but after these messages are successfully transmitted. The In process (.IP) bit is cleared and the Process Complete (.PC) bit is set at the same time that the Done (.DN) bit is set.
Description - AXIS_CIP_DRIVE
The MRHD instruction is used to execute various test diagnostics on the specified CIP axis to test the integrity and, in some cases, the polarity of servo field connections. There are currently test diagnostics supporting drive hookup, encoder hookup, marker hookup and motor commutation hookup. During some of these test processes, the motion module generates output to the external drive to produce a small amount of motion. Measurements made during some of these hookup diagnostic tests are saved as output configuration parameters. MRHD requires only one explicit input parameter, Diagnostic Test. Enter or select the Diagnostic Test to run and the axis to test.
If the targeted axis does not appear in the list of available axes, the axis has not been configured for operation. Use the Tag Editor to create and configure a new axis.
The MRHD instruction uses the CIP axis configuration parameters as input and output. The input configuration parameters that the MRHD uses are shown in this table.
Axis Parameter
Data Type
Units
Meaning
Hookup Test Distance
Real
Position Units
Distance that the axis must travel to satisfy the selected hookup test process.
Hookup Test Time
Real
Seconds
Time that the axis must continue moving to satisfy the selected hookup test
Hookup Test Feedback Channel
USINT
-
Used by the Hookup Test service when the encoder test is selected to determine which feedback channel to test
1 = Feedback 1
2 = Feedback 2.
The CIP axis configuration parameters that MRHD generates as output depend on the specified Hookup Diagnostic.
Motor Encoder Hookup Test
The Motor Encoder Hookup test is selected, the motion module enables the external drive and generates a 1 Volt per second output ramp to the drive while monitoring the encoder feedback. When the axis has moved a distance greater than or equal to the configured Motor Encoder Test Increment, the test voltage is set back to zero and the drive is disabled. The motion module then reports the direction of travel that is stored as one of these output parameters.
Axis Parameter
Data Type
Units
Meaning
Hookup Test Status
USINT
-
Returns the status of the last Run Hookup Test service on the targeted drive axis.  The Hookup Test Status attribute can be used to determine when the hookup test service has successfully completed.
Conditions may occur, however, that make it impossible for the drive to properly perform the operation. When this is the case, the test process is automatically terminated and a test error is reported that is stored in the Hookup Test Status output parameter.
0 = test process successful
1 = test in progress
2 = test process aborted
3 = test process timed-out
4 = test process faulted
5 = test failed - no feedback 1 counts
6 = test failed - no feedback 2 counts
7-127 = reserved
128 = test not allowed in Axis Test Mode
129-255 = reserved 2
Hookup Test Feedback Direction 1
USINT
-
Reports the direction of axis travel during the last hookup test, as detected by the drive's feedback 1 device.
0 = The drive’s feedback 1 device detected a positive direction, that is, increasing counts.
1 = The drive’s feedback 1 device detected a negative direction, that is, decreasing counts.
2-255 = reserved
The value for Hookup Test Feedback 1 Direction, as determined by the hookup test, does not depend on the current feedback, motor, or motion polarity attribute configuration. This value, combined with the user’s definition of forward direction, can be used to configure the various polarity attributes for the correct directional sense.
Hookup Test Feedback Direction 2
USINT
-
Reports the direction of axis travel during the last hookup test, as detected by the drive's feedback 2 device.
0 = The drive’s feedback 2 device detected a positive direction, that is, increasing counts.
1 = The drive’s feedback 2 device detected a negative direction, that is, decreasing counts.
2-255 = reserved
The value for Hookup Test Feedback 2 Direction, as determined by the hookup test, does not depend on the current feedback, motor, or motion polarity attribute configuration. This value, combined with the user’s definition of forward direction, can be used to configure the various polarity attributes for the correct directional sense.
If due to improper hookup, or some other problem with the system, the axis feedback fails to detect the axis reaching the configured Motor Encoder Test Increment within 2 seconds, the servo sets the test voltage back to zero and disables the drive. The control reflects this condition through the Test Status axis output parameter. This usually indicates that either the cabling to the drive or the cabling to the encoder is incorrect. Running MRHD with the Encoder Hookup Test selected is an effective method of isolating the problem to the encoder or drive.
Encoder Hookup Test
If the Encoder Test is selected, the motion module does not generate any axis motion, but simply monitors axis encoder feedback. The axis can then be moved by hand or by some other independent drive actuator to generate motion. When the motion module detects that the axis has moved a distance greater than or equal to the configured Motor Encoder Test Increment, the test is complete. The motion module then reports the direction of travel as one of these MRHD output parameters:
Axis Parameter
Data Type
Units
Meaning
Hookup Test Status
USINT
-
Returns the status of the last Run Hookup Test service on the targeted drive axis.  The Hookup Test Status attribute can be used to determine when the hookup test service has successfully completed.
Conditions may occur, however, that make it impossible for the drive to properly perform the operation. When this is the case, the test process is automatically terminated and a test error is reported that is stored in the Hookup Test Status output parameter.
0 = test process successful
1 = test in progress
2 = test process aborted
3 = test process timed-out
4 = test process faulted
5 = test failed - no feedback 1 counts
6 = test failed - no feedback 2 counts
7-127 = reserved
128 = test not allowed in Axis Test Mode
129-255 = reserved 2
Hookup Test Feedback Direction 1
USINT
-
Reports the direction of axis travel during the last hookup test, as detected by the drive's feedback 1 device.
0 = The drive’s feedback 1 device detected a positive direction, that is, increasing counts.
1 = The drive’s feedback 1 device detected a negative direction, that is, decreasing counts.
2-255 = reserved
The value for Hookup Test Feedback 1 Direction, as determined by the hookup test, does not depend on the current feedback, motor, or motion polarity attribute configuration. This value, combined with the user’s definition of forward direction, can be used to configure the various polarity attributes for the correct directional sense.
Hookup Test Feedback Direction 2
USINT
-
Reports the direction of axis travel during the last hookup test, as detected by the drive's feedback 2 device.
0 = The drive’s feedback 2 device detected a positive direction, that is, increasing counts.
1 = The drive’s feedback 2 device detected a negative direction, that is, decreasing counts.
2-255 = reserved
The value for Hookup Test Feedback 2 Direction, as determined by the hookup test, does not depend on the current feedback, motor, or motion polarity attribute configuration. This value, combined with the user’s definition of forward direction, can be used to configure the various polarity attributes for the correct directional sense.
If due to improper hookup, or some other problem with the system, the axis feedback fails to detect the axis reaching the configured Motor Encoder Test Increment after moving the axis at least that distance, then abort the test using the MAS instruction and check the encoder wiring.
Marker Hookup Test
If the Marker Test is selected, the motion module does not generate any axis motion, but simply monitors axis encoder feedback. The axis can then be moved by hand or by some other independent drive actuator to generate motion. When the motion module detects a marker (Channel Z) pulse, the test is then complete. The motion module then reports success via the Test Status.
Axis Parameter
Data Type
Units
Meaning
Hookup Test Status
USINT
-
Returns the status of the last Run Hookup Test service on the targeted drive axis.  The Hookup Test Status attribute can be used to determine when the hookup test service has successfully completed.
Conditions may occur, however, that make it impossible for the drive to properly perform the operation. When this is the case, the test process is automatically terminated and a test error is reported that is stored in the Hookup Test Status output parameter.
0 = test process successful
1 = test in progress
2 = test process aborted
3 = test process timed-out
4 = test process faulted
5 = test failed - no feedback 1 counts
6 = test failed - no feedback 2 counts
7-127 = reserved
128 = test not allowed in Axis Test Mode
129-255 = reserved 2
Hookup Test Feedback Direction 1
USINT
-
Reports the direction of axis travel during the last hookup test, as detected by the drive's feedback 1 device.
0 = The drive’s feedback 1 device detected a positive direction, that is, increasing counts.
1 = The drive’s feedback 1 device detected a negative direction, that is, decreasing counts.
2-255 = reserved
The value for Hookup Test Feedback 1 Direction, as determined by the hookup test, does not depend on the current feedback, motor, or motion polarity attribute configuration. This value, combined with the user’s definition of forward direction, can be used to configure the various polarity attributes for the correct directional sense.
Hookup Test Feedback Direction 2
USINT
-
Reports the direction of axis travel during the last hookup test, as detected by the drive's feedback 2 device.
0 = The drive’s feedback 2 device detected a positive direction, that is, increasing counts.
1 = The drive’s feedback 2 device detected a negative direction, that is, decreasing counts.
2-255 = reserved
The value for Hookup Test Feedback 2 Direction, as determined by the hookup test, does not depend on the current feedback, motor, or motion polarity attribute configuration. This value, combined with the user’s definition of forward direction, can be used to configure the various polarity attributes for the correct directional sense.
If due to improper hookup, or some other problem with the system, the axis feedback fails to detect that axis reaching the configured Motor Encoder Test Increment after moving the axis at least that distance, then abort the test using the MAS instruction and check the encoder wiring.
Commutation Test
The Commutation test only applies to PM motors. This test applies current to the motor to align the rotor and check for proper phasing of a UVW encoder or Hall sensor, if applicable. Finally, the test measures the commutation offset.
TIP:
For linear stages, make sure there is enough travel. If there is not enough travel, the test produces a fault.
Axis Parameter
Data Type
Units
Definition
Hookup Test Status
USINT
-
Returns the status of the last Run Hookup Test service on the targeted drive axis.  The Hookup Test Status attribute can be used to determine when the hookup test service has successfully completed.
Conditions may occur, however, that make it impossible for the drive to properly perform the operation. When this is the case, the test process is automatically terminated and a test error is reported that is stored in the Hookup Test Status output parameter.
0 = test process successful
1 = test in progress
2 = test process aborted
3 = test process timed-out
4 = test process faulted
5 = test failed - no feedback 1 counts
6 = test failed - no feedback 2 counts
7-127 = reserved
128 = test not allowed in Axis Test Mode
129-255 = reserved 2
Hookup Test Commutation Polarity
USINT
-
Reports if the UVW phasing of the Encoder or Hall Sensor match the phasing of the Motor.  If the motor and UVW commutation phasing do not match the Commutation Polarity is Normal.
If it is determined that the phasing for the motor and commutation device do not match, this parameter reports that the Commutation direction is Inverted.  This value can be used to configure the Commutation Polarity attribute.
0 = normal
1 = inverted
2-255 = reserved
Hookup Test Commutation Offset
Real
Electrical Degrees
The Hookup Test Commutation Offset reports the measured commutations offset of a PM motor during the Commutation Test. This represents the value that must be applied to the motor position accumulator in order to align the Electrical Angle signal with motor stator windings.  This value can be used to configure the Commutation Offset attribute.
Test Status
This parameter returns the status of the last Run Hookup Test service on the targeted drive axis. Conditions may occur that make it impossible for the control to properly perform the test operation. When this is the case, the test process is automatically aborted and a test fault is reported and stored in the Hookup Test Status output parameter. Possible values for Test Status are shown in the table below:
Error Message
Code
Definition
Test Success
0
Test Process has been successful.
Test In Process
1
Test is in progress.
Test Aborted
2
Test Process was aborted by user.
Test Time-out
3
Test Process has exceeded timed out (2 seconds).
Test Servo Fault
4
Test Process Failed due to Servo Fault.
No Feedback 1
5
Test Process Failed - no feedback 1 counts.
No Feedback 2
6
Test Process Failed - no feedback 2counts.
Test not allowed in Axis Test Mode
128
Test Process Failed - Axis Test Mode enabled.
In this transitional instruction, the relay ladder, toggle the Rung-condition-in from cleared to set each time the instruction should execute.
Affects Math Status Flags
No
Major/Minor Faults
None specific to this instruction. A major fault can occur if an uninitialized reference or a reference of incorrect type is passed to the Axis operand. See Common Attributes for operand-related faults.
Execution
Ladder Diagram
Condition/State
Action Taken
Prescan
The .EN, .DN, .ER, and .IP bits are cleared to false.
Rung-condition-in is false
The .EN bit is cleared to false if either the .DN or .ER bit is true.
Rung-condition-in is true
The .EN bit is set to true and the instruction executes.
Postscan
N/A
Structured Text
Condition/State
Action Taken
Prescan
See Prescan in the Ladder Diagram table.
Normal execution
See Rung-condition-in is false, followed by rung is true in the Ladder Diagram table.
Postscan
See Postscan in the Ladder Diagram table.
Error Codes
See Motion Error Codes (ERR) for Motion Instructions.
Extended Error Codes
Extended Error Codes provide additional instruction specific information for the Error Codes that are generic to many instructions. Motion Error Codes (ERR) for Motion Instructions. The following Extended Error codes help to pinpoint the problem when the MRHD instruction receives an error message.
Associated Error Code (decimal)
Extended Error Code (decimal)
Meaning
SERVO_MESSAGE_FAILURE (12)
Process terminated on request (1)
Test execution followed by an instruction to shutdown/disable drive, or a motion stop instruction or a Processor change requests a cancel of the Test.
SERVO_MESSAGE_FAILURE (12)
Object Mode conflict (12)
Axis is in shutdown.
SERVO_MESSAGE_FAILURE (12)
Device in wrong state (16)
Incorrect Tune Process order. (SERCOS)
TEST_PROCESS_ERROR (15)
Motor Feedback Test Prohibited (1)
Axis Test Mode enabled - Motor and Feedback Test is not supported in this configuration.
Status Bits
MRHD Changes to Status Bits
Bit Name
State
Meaning
DriveEnableStatus
TRUE
The axis is in Drive Control state.
The Drive Enable output is active while the Tuning Profile is running.
TestStatus
TRUE
The axis is running a testing process.
Example 1
When the input conditions are true, the controller runs the encoder diagnostic test on Axis1.
Ladder Diagram
MRHD_LD_ex_v31
Neutral Text Representation for RLL
MRHD(Axis1, MRHD_1, Motor_Encoder);
Structured Text
MRHD(Axis1, MRHD_1, Motor_Encoder);
Example 2
When the input conditions are true, the controller runs the encoder diagnostic test on Axis1 through a reference to it.
Ladder Diagram
MRHD_LD_ex_v31
Neutral Text Representation for RLL
MRHD(Ref_Axis1, MRHD_1, Motor_Encoder);
Structured Text
MRHD(Ref_Axis1, MRHD_1, Motor_Encoder);
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.