It is important to perform error handling in instrument control applications because there are several potential sources for errors.
VISA functions can return errors because VISA or the underlying software or hardware is not properly installed. For example, when communicating with GPIB instruments, NI-488.2 must be installed correctly to use National Instruments' GPIB controller card. Similarly, if the board is not installed or is not correctly configured, the instrument driver VIs will return an error. This type of error can be detected with the Error Message VI or the General Error Handler VI.
VISA functions can return errors if the device you are accessing is not responding the commands you have sent. The instrument could be incorrectly addressed, malfunctioning, or unable to understand the commands that are being sent. This type of error can be detected with the Error Message VI or the General Error Handler VI.
The instrument reports errors. Generally, an instrument will flag an error for reasons ranging from invalid commands to settings out of range to missing hardware options. These instrument errors can be detected by calling the instrument driver's Error Query VI followed by the Error Message VI.