flex_read_error_msg_rtn

NI-Motion Functions

flex_read_error_msg_rtn

Device Compatibility

Device Compatibility
7330
Y
7340
Y
7344
Y
7350
Y
7390
Y
NI SoftMotion Controller for CANopen—Xenus
Y
NI SoftMotion Controller for CANopen—Accelnet
Y

Read Error Message Return

Usage

status = flex_read_error_msg_rtn(u8 boardID, u16* commandID, u16* resourceID, i32* errorCode);

Purpose

Reads the most recent modal error from the Error Message Stack.

Tip  Refer to the Remarks section for information about how the behavior of this function differs between controllers.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
commandID u16* command ID number
resourceID u16* resource ID number
errorCode i32* error code

Parameter Discussion

commandID is the command ID of the function that caused the error.

resourceID is the resource ID involved in the error.

errorCode is the code for the error condition.

Using This Function

This function retrieves the most recent modal error from the controller and returns the command ID and resource ID that caused the error, along with the error code.

Note  See Error Codes for a description of error codes and possible causes.

When a modal error occurs, the command ID, resource ID, and error code are automatically stored in a last-in-first-out stack and the Error Message (Err Msg) bit in the Communication Status Register is set to indicate that one or more errors are present on the stack.

Modal errors are defined as errors that are not detected at the time of function execution. Refer to Errors and Error Handling for a complete description.

These errors can occur for a number of reasons including: bad command ID, bad axis, vector space or resource ID, data out of range, function not valid in the present operating mode, and so on. A common source of modal errors is improperly constructed function calls stored in an onboard program. When the program is run, the errors generate modal error messages.

Because the error messages are stored in a last-in-first-out (LIFO) buffer, the most recent error is available immediately. You can read older errors with additional calls to this function. When the stack is empty, the Error Message (Err Msg) bit in the Communication Status Register is reset.

You can get a string description of the error by using the Get Error Description function.

Normally, if the application program is functioning correctly, errors are not generated. Reading the error messages from the board is useful during debugging and for handling special conditions.

Example

An application program running on the host computer monitors the Communication Status Register to check for errors. If the Error Message bit is set, the program sends a Read Error Message function to the controller and then reacts to the error information returned. Depending upon the type of error and/or the function and resource involved, the appropriate action is taken. You can check the Error Message bit again to see if any previous errors were missed.

Remarks

This section includes information about how the behavior of this function differs among the controllers that support it.

NI SoftMotion Controller Considerations

The following list includes considerations you must make when you are using this function with the NI SoftMotion Controller:

  • The commandID read in is always zero (0).
  • The errors stack is always in FIFO mode.