ni.com checkout is currently experiencing issues.
Support teams are actively working on the resolution.
ni.com checkout is currently experiencing issues.
Support teams are actively working on the resolution.
Overview
User developed run-time error checking tools with increased messaging and level of detail.
Note: This is not a complete a functional sample code: instead, it is intended as some suggestions to be integrated and eventually adapted to your actual application and programming style and standards.
Description
With the exception of some high-level operators that are aware of internal software specifications, the user is interested to know that a serious error has raised and that the program is not working correctly; date and time the error raised can be useful too; advanced users and the programmer are more interested to function / source file / type of error and line where the error occurred. All of these informations could be either displayed on the screen or saved to disk (or both).
This implementation is basically an extension / adaptation of the good errChk and nullChk macros already defined in the programmer's toolbox. These extended macros adds the information about the line the error raised. Additionally, similar macros were developed to handle several different types of errors that can occur at runtime: file I/O operations, serial communications, DAQ acquistion / generation of signals, etc... Macros were added to handle errors that can arise while executing a loop that needs to be completed in a proper way.
To display error information, one solution would be to use a MessagePopup with all relevant information within the originating function. When executing multithreaded applications this may not be an optimal solution as the program cannot simply be halted waiting for user action. In this case all information must be conveyed out of the execution thread and passed to the main thread, where the message can be prompted without disturbing the running threads.
Steps to Implement Code
1. Download and extract zip folder contents
2. Include files in project
3. Reference header file.
Requirements
Software
-LabWindows CVI
**This document has been updated to meet the current required format for the NI Code Exchange. For more details visit this discussion thread**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
copy-paste typo
In the code block given below in the article, all inputs "daqerr" to ErrorMessage function as error code.
Shouldn't it differ for each type of error?
...
ErrorMessage (daqerr, ERRDAQ, line, __FUNCTION__, __FILE__)
else if (error < 0)
ErrorMessage (daqerr, ERRGEN, line, __FUNCTION__, __FILE__)
else if (comerr < 0)
ErrorMessage (daqerr, ERRCOM, line, __FUNCTION__, __FILE__)
else if (ioerr < 0)
ErrorMessage (daqerr, ERRIO, line, __FUNCTION__, __FILE__)
...
copy-paste typo
Thanks Eren for the advise: of course you are right and I have corrected the source code according to it. :)
Can you move the code out of the text of the main document and into a separate download file. The main document is very unreadable, and should not contain long sections of code. Any code in the main documented should be formatted to read easily.