How Do I Programmatically Reinitialize a GPIB Board When an Error Occurs In an Application?

Updated Apr 19, 2024

Environment

Driver

  • NI-VISA
  • GPIB Software

I have a GPIB application that works fine for several hours, but sometimes I get an error (e.g., a timeout error on a GPIB Read), and I lose communication with my GPIB instruments. How do I regain communication with my instruments without exiting and re-launching my program?

To regain communication with your instruments after you receive an error, you will need to send an interface clear command to your GPIB board. 
If you are using the NI-488.2 API, you can send an interface clear with the SendIFC VI in LabVIEW, or the SendIFC() function in text-based environments. If you are programming with the NI-VISA API, then you can use the VISA GPIB Send IFC VI in LabVIEW, or the viSendGpibIFC() function in text-based environments. 

You may also use the ResetSys VI to reset the bus, but that will cause all IEEE 488.2-compliant devices on the bus to perform device-specific resets and initializations.