Serial Port Support Example (VB)
From NI-VISA
Serial Port Support Example (Visual Basic)
| Note The Visual Basic examples in the NI-VISA Help use the VISA data types where applicable. This feature is available only on Windows. To use this feature, select the VISA library (visa32.dll) as a reference from Visual Basic. This makes use of the type library embedded into the DLL. |
Private Declare Function viGetAttrString Lib "VISA32.DLL" Alias "#133" (ByVal vi As ViSession, ByVal attrName As ViAttr, ByVal strValue As Any) As ViStatus
If (stat < VI_SUCCESS) Then Rem Error initializing VISA ... exiting End If Rem Error finding resources ... exiting End If stat = viOpen(dfltRM, rsrcName, VI_NULL, VI_NULL, sesn) Debug.Print "Could not open resource", rsrcName, "Status", stat Else stat = viGetAttrString(sesn, VI_ATTR_INTF_INST_NAME, instrDesc) End If Wend End Sub |