Hello,
I am using Excel VBA and visa32.dll to communicate with dmm Keithley2700 by using serial port. However it seems that I cannot write/read to/from the equipment. Below are the codes that I am struggling and stuck. I really appreciate any advice or sharing some example. Thank you.
Dim stat As ViStatus
Dim defaultRM As ViSession
Dim instr As ViSession
Dim retCount As Long
Dim sesn As ViSession
Dim buffer As String
Dim idnResult As String
stat = viOpenDefaultRM(defaultRM)
If (stat < VI_SUCCESS) Then
Rem Error initializing VISA...exiting
Cells(1, 3).Value = Error
Exit Sub
End If
stat = viOpen(defaultRM, "ASRL3::INSTR", 0, 50, sesn)
stat = viSetAttribute(sesn, VI_ATTR_TMO_VALUE, 5000)
stat = viWrite(sesn, "*IDN?", 5, retCount)
stat = viRead(sesn, idnResult, 72, retCount)
Cells(1, 4).Value = idnResult
stat = viClose(sesn)
stat = viClose(defaultRM)