Motion Apply Hookup Diagnostics (MAHD)
This information applies to the
CompactLogix
5370, ControlLogix
5570, Compact GuardLogix
5370, GuardLogix
5570, and ControlLogix
5580 controllers.The Motion Apply Hookup Diagnostics (MAHD) instruction is used to apply the results of a previously run the Motion Run Hookup Diagnostics (MRHD) instruction to generate a new set of encoder and servo polarities based on the Observed Direction of motion during the test. As part of the application process the instruction updates the motion module with these new polarity settings. After execution of the MAHD instruction, and assuming that a stable set of gains was established, the corresponding axis should be ready for servo activation.
Available Languages
Ladder Diagram
Function Block
This instruction is not available in function block.
Structured Text
MAHD(Axis,MotionControl,DiagnosticTest,ObservedDirection);
Operands
There are data conversion rules for mixed data types within an instruction. See Data Conversion.
Ladder Diagram and Structured Text
Operand | Type | Format | Description |
Axis | AXIS_SERVO AXIS_SERVO_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 | Tag | Structure used to access instruction status parameters. |
Diagnostic Test | UDINT | Immediate | Selects the specific test for the motion module to run: 0 = motor/encoder hookup test 1 = encoder hookup test 2 = encoder marker test |
Observed Direction | BOOLEAN | Immediate | Sets the direction of the test motion. Select either: 0 = forward 1 = reverse |
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 | 0 1 2 |
ObservedDirection | forward reverse | 0 1 |
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. |
Description
The MAHD instruction is used to execute a series of computations resulting in values for the Encoder Polarity and Servo Polarity configuration bit parameters of the specified axis. As part of work performed by MAHD, these resultant configuration bit parameters are applied to the motion module so that the axis is ready for full servo operation. This instruction is designed to follow execution of the Motion Run Hookup Diagnostics (MRHD) instruction which generates axis input configuration values for the MAHD instruction. See the MRHD instruction description for more information. MAHD requires specification of the Diagnostic Test to apply and the Observed Direction of motion during the previous Motion Run Hookup Diagnostics (MRHD) instruction test process. Enter or select the Diagnostic Test and the Observed Direction and the desired physical axis.
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 MAHD instruction uses axis configuration parameters as input and output. The input configuration parameters that MAHD uses are shown in this table. The Test Direction Forward bit is automatically established as output from the Motion Run Hookup Diagnostics (MRHD) instruction.
Axis Parameter | Data Type | Units | Meaning |
Test Direction Forward | Boolean | - | Direction of axis travel during hookup test as seen by the motion module. |
Motor Encoder Hookup Test
If the Motor Encoder Test is selected, the controller computes the proper setting for both the Encoder Polarity and the Drive Polarity based on the Observed Direction instruction parameter and the state of Test Direction Forward bit which was established by the output of the Motion Run Hookup Diagnostics (MRHD) instruction. Once the Encoder Polarity and Drive Polarity settings are computed the MAHD applies these values to the corresponding axis configuration parameter bits as shown in this table:
Axis Parameter | Data Type | Units | Meaning |
Encoder Polarity Negative | Boolean | - | Inverts the sense of the encoder feedback input to the motion module. |
Drive Polarity Negative | Boolean | - | Inverts the sense of the DAC analog output from the motion module. |
Encoder Hookup Test
If the Encoder Test is selected, the controller computes the proper setting for just the Encoder Polarity based on the Observed Direction instruction parameter and the state of Test Direction Forward bit which was established by the output of the Motion Run Hookup Diagnostics (MRHD) instruction. Once the Encoder Polarity and Drive Polarity settings are computed, the MAHD applies these values to the corresponding axis configuration parameter bits as shown in this table.
Axis Parameter | Data Type | Units | Meaning |
Encoder Polarity Negative | Boolean | - | Inverts the sense of the encoder feedback input to the motion module. |
To successfully execute a MAHD instruction running the Motor Encoder Test, the targeted axis must be configured as either a Servo or Feedback Only axis type. If any of these conditions are not met than the instruction errs.
IMPORTANT:
The instruction execution may take multiple scans to execute because it requires multiple coarse updates to complete the request. The Done (.DN) bit is not set immediately, but only after the request is completed.
This is a transitional instruction:
- In relay ladder, toggle EnableIn from false to true each time the instruction should execute.
- In structured text, condition the instruction so that it only executes on a transition.
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 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. See Motion Error Codes (ERR) for Motion Instructions. The following Extended Error codes help to pinpoint the problem when the MAHD instruction receives a Servo Message Failure (12) error message.
Associated Error Code (decimal) | Extended Error Code (decimal) | Meaning |
SERVO_MESSAGE_FAILURE (12) | No resources (2) | Not enough memory resources to complete request. (SERCOS) |
SERVO_MESSAGE_FAILURE (12) | Object Mode conflict (12) | Axis is in shutdown. |
SERVO_MESSAGE_FAILURE (12) | Permission denied (15) | Enable input switch error. (SERCOS) |
SERVO_MESSAGE_FAILURE (12) | Device in wrong state (16) | Redefine Position, Home, and Registration 2 are mutually exclusive (SERCOS), device state not correct for action. (SERCOS) |
Status Bits
MAHD Changes to Status Bits
None
Example 1
When the input conditions are true, the controller applies the results of a previously executed Motion Run Hookup Diagnostics (MRHD) instruction to Axis1.
Ladder Diagram
Neutral Text for Ladder Diagram Normal Scan
MAHD(Axis1, MAHD_1, Marker, Forward);
Structured Text
MAHD(Axis1, MAHD_1, Marker, Forward);
Example 2
When the input conditions are true, the controller applies the results of a previously executed Motion Run Hookup Diagnostics (MRHD) instruction to Axis1 through a reference to it.
Ladder Diagram
Neutral Text for Ladder Diagram Normal Scan
MAHD(Ref_Axis1, MAHD_1, Marker, Forward);
Structured Text
MAHD(Ref_Axis1, MAHD_1, Marker, Forward);
Provide Feedback