NI VISA Interface Clear Workaround

NI VIsa Interface Clear has a minor bug causing it to time out if no resources exist on the bus. Here is a method aimed at a work around as part of a class that inherits the NationalInstruments.VisaNS.GpibInterface.

Adding, checking in, and archiving Visual Source Safe 2005 projects using batch files;
Failing to work around the limitations of Authenticode for signing large Excel project
Stay tuned.

Try
MyBase.SendInterfaceClear()
Return MyBase.LastStatus
Catch ex As NationalInstruments.VisaNS.VisaException When ex.ErrorCode = VisaStatusCode.ErrorTimeout
‘ trap timeout error. Apparently, VISA is trying to send commands to the devices
‘ even if none are present.
‘ un-time exception thrown:
‘ NationalInstruments.VisaNS.VisaException – Timeout expired before operation completed.
‘ VISA error code -1073807339 (0xBFFF0015), ErrorTimeout
Return VisaStatusCode.ErrorTimeout
Catch
Throw
End Try

End Function

This article is licensed under The Code Project Open License (CPOL)