Read Error Message

NI-Motion VI

Read Error Message

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

Details     Remarks

Device Compatibility

DeviceCompatibility
7330
Y
7340
Y
7344
Y
7350
Y
7390
Y
NI SoftMotion Controller for CANopen—Accelnet
Y
NI SoftMotion Controller for CANopen—Xenus
Y
Board ID is a unique number assigned by Measurement & Automation Explorer (MAX) used to send and receive commands and data to or from a specific NI motion controller.
error in (no error) describes error conditions that occur before this VI runs. The default input of this cluster is no error. If an error already occurred, this VI returns the value of error in in error out. The VI runs normally only if no incoming error exists. Otherwise, the VI passes the error in value to error out. The error in cluster contains the following parameters:
status is TRUE if an error occurred before this VI was called, or FALSE if not. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code.
code is a number identifying an error or warning. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code. Use the error handler VIs to look up the meaning of this code and display the corresponding error message.
source is a string that indicates the origin of the error, if any. Typically, source is the name of the VI in which the error occurred.
Resource is the Axis, Vector Space, ADC, or Encoder you wired into the VI. Use Resource Output to pass the resource to another VI and/or to display information about the device. Resource is the resource ID involved in the error.
Bd ID Out is provided for flow control. You can string together NI-Motion VIs by wiring the Bd ID Out terminal of one VI to the Board ID terminal of the next VI.
error out contains error information. If error in indicates an error, error out contains the same error information. Otherwise, it describes the error status that this VI produces.
status is TRUE if an error occurred, or FALSE if not. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code.
code is a number identifying an error or warning. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code. Use the error handler VIs to look up the meaning of this code and display the corresponding error message.
source is a string that indicates the origin of the error, if any. Typically, source is the name of the VI in which the error occurred.
Error Code is the code for the error condition.
Command ID is the command ID of the VI that caused the error.

Using This VI

The Read Error Message VI retrieves the most recent modal error from the controller and returns the command ID and resource ID that cause 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 VI execution. For a complete description, refer to Errors and Error Handling. A common source of modal errors is improperly constructed VI 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 VI. 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 VI.

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 VI to the controller and then reacts to the error information returned. Depending upon the type of error and/or the VI 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 VI differs among the controllers that support it.

NI SoftMotion Controller Considerations

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

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