Error Handling Techniques
In addition to using the error in and error out terminals on each motion VI, check for modal errors by calling the Motion Error Handler VI in the application. The Motion Error Handler VI checks the controller for errors and read and display errors from the Error Stack if they exist. Refer to the example VIs in the LabVIEW\Examples\Motion\NI-Motion directory to see how this VI is used.
How often to check for modal errors depends upon the application, but you can use the following list as a guideline:
- Check for errors at the end of each major subroutine or functional block.
- Check for errors at the end of an initialization procedure. Even better is to also check after each axis initialization. After executing a Find Reference VI, check to make sure the sequence completed successfully.
- Include an error check in every status polling loop. Most applications include a polling loop to display motion status, position, velocity, and so on. This way you are assured of never missing an error.
- During debugging, you can run an independent VI to check for errors. The Error Monitor VI in the Error & Utility palette is provided for this purpose. You can run this VI while another VI is executing motion VIs, and the Error Monitor displays modal errors.
For additional information about errors, refer to the following topics: