Hello,
I have a small vba program I am trying to modify, to access a Fluke 187 Multimeter through a com port (4) but am having a issue when it goes to run the ReadString() code.
I didnt make this module, I and trying to adapt it from GpiB to com port.
I can successfully open, and send a command to the meter, but when when you click the read from meter button, (Read *IDN?), it seems to pause for about 10 seconds, and then give me a "visa error = timeout expired before operation completed" error and stops.
I set the line of code in question in Red Bold letters so you can find it better, below in the code block.
I can use Putty and connect to the meter and run the ID command and it will spit out in putty Make,Model,Serial number information. I just need to bring that information from the meter to Excel.
I got this vba from the Keysight website
https://community.keysight.com/thread/21917
I am sure there is a better way to do this without other users needing to download any other code or software.
Any help would be greatly greatly appreciated.
I have a small vba program I am trying to modify, to access a Fluke 187 Multimeter through a com port (4) but am having a issue when it goes to run the ReadString() code.
I didnt make this module, I and trying to adapt it from GpiB to com port.
I can successfully open, and send a command to the meter, but when when you click the read from meter button, (Read *IDN?), it seems to pause for about 10 seconds, and then give me a "visa error = timeout expired before operation completed" error and stops.
I set the line of code in question in Red Bold letters so you can find it better, below in the code block.
I can use Putty and connect to the meter and run the ID command and it will spit out in putty Make,Model,Serial number information. I just need to bring that information from the meter to Excel.
I got this vba from the Keysight website
https://community.keysight.com/thread/21917
I am sure there is a better way to do this without other users needing to download any other code or software.
Code:
Option Explicit
Dim ioMgr As VisaComLib.ResourceManager
Dim instrAny As VisaComLib.FormattedIO488
Dim instrQuery As String
Dim instrAddress As String
Public Sub Intialize_Click()
On Error GoTo ioError
instrAddress = Range("B4").Value
Set ioMgr = New VisaComLib.ResourceManager
Set instrAny = New VisaComLib.FormattedIO488
Set instrAny.IO = ioMgr.Open("ASRL4::INSTR")
Dim serInfc As VisaComLib.ISerial
Set serInfc = instrAny.IO
serInfc.BaudRate = 9600
serInfc.FlowControl = ASRL_FLOW_NONE
serInfc.Timeout = 10000
instrAny.IO.SendEndEnabled = True
instrAny.IO.TerminationCharacter = 10 ' could be 10 (line feed) or 13 (carriage return)
instrAny.IO.TerminationCharacterEnabled = True
instrAny.IO.Timeout = 10000
Exit Sub
ioError:
MsgBox "An IO error occured:" & vbCrLf & Err.Description
End Sub
Public Sub cmdSendIDN_Click()
On Error GoTo ioError
instrAny.WriteString ("ID")
MsgBox "ID has been sent to Instrument"
Exit Sub
ioError:
MsgBox "An IO error occured:" & vbCrLf & Err.Description
End Sub
Public Sub cmdReadIDN_Click()
On Error GoTo ioError
[COLOR=#ff0000][B] instrQuery = instrAny.ReadString()[/B][/COLOR]
MsgBox instrQuery, , "Instrument response to ID"
Exit Sub
ioError:
MsgBox "An IO error occured:" & vbCrLf & Err.Description
End Sub
Public Sub instrclose_Click()
On Error GoTo ioError
instrAny.IO.Close
MsgBox "Connection Closed"
Exit Sub
ioError:
MsgBox "An IO error occured:" & vbCrLf & Err.Description
End Sub
Any help would be greatly greatly appreciated.