Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

V and I measurements return empty strings (EDVR(0) and EHDL(23) errors) - stops working after 125 measurements of each?

I am setting up a system using the Keithley 7065 Hall Effect card and am using the Keithley 2400 Sourcemeter, 2000 Multimeter, 6514 Electrometer, and 7001 Switch System. I have a program in VB6 that is attempting to measure the resistivity of a sample by measuring voltages and currents. There are 8 different combinations of currents and voltages being measured. For each combination, 30 V and I measurements are taken (and averaged) to determine the R. When I use the electrometer to measure the current, the program goes through 4 different VI combinations (at 30 measurements each) successfully before crashing (crashes when j = 5 and i = 4), giving EDVR(0) and EHDL(23) errors (see attached NI Spy screen capture). When I trace the program, the measured voltage is coming back as an empty string (and so is the measured current). Is it because I am filling up some buffer and so I can't take any more measurements? That could explain why it works fine at first and then crashes.

Here is a part of my code:
NOTE: for some reason, I can't get SEND() to work, so I altered it to just use the device-level commands (e.g, ibrd)

For i = 0 To 7 'go through each different voltage combination
sumVavg = 0
sumIavg = 0
DoEvents
Call send(ss, ":CLOS (@" + getCrossPointsRes(i) + ")", status)
Call send(sm, ":OUTP:STAT ON", status)
DoEvents
Sleep PauseTime
numit = 30 'number of measurements to take for each combo
For j = 1 To numit
srcbeep (j)
Call send(mm, ":MEAS:VOLT?", status)
Call GetReply(meas_volt, CInt(255), CInt(1), mm, status)
Call send(em, ":MEAS:CURR?", status)
Call GetReply(meas_curr, CInt(255), CInt(1), em, status)
sumVavg = sumVavg + val(meas_volt)
sumIavg = sumIavg + val(meas_curr)
DoEvents
Next j
Call send(sm, ":OUTP:STAT OFF", status)
Call send(ss, ":OPEN ALL", status)
data(0, i) = sumVavg / numit
data(1, i) = sumIavg / numit
data(2, i) = data(0, i) / data(1, i)
txtCurrent(i).Caption = data(1, i)
txtVoltage(i).Caption = data(0, i)
txtRes(i).Caption = data(2, i)
Next i

Public Sub GetReply(r As String, Maxlen As Integer, l As Integer, addr As Integer, status As Integer)

Dim stl As Long
Dim ll As Long
Dim myStr As String * 1024
stl = ibdev32(0, addr, 0, 13, 1, 0)
blah = ConvertLongToInt(stl)
r = ilrd(blah, myStr$, Len(myStr$))
l = ll
r = myStr
status = stl
End Sub

Sub send(addr As Integer, myCom As String, mtStat As Integer)
blah = ConvertLongToInt(ibdev32(0, addr, 0, 13, 1, 0))
Call ilwrt(blah, myCom, Len(myCom))
End Sub
0 Kudos
Message 1 of 3
(3,319 Views)
The problem is that you keep opening up device handles to the same device, but never close them. The NI-488.2 driver limits the number of open device handles to 1024. For what you're doing you could really just call ibdev once and store the device handle that you get back. Otherwise, you should really call ibonl(ud, 0) to take the device handle offline following its usage. This will help you to prevent resource leaks.

Craig A
National Instruments Engineer
Message 2 of 3
(3,319 Views)
og, nevermind. i did the call ibdev only once thing instead and it seems to work now without crashing. the current and voltages i get seem kind of off, though.

THANKS for your help, though!
0 Kudos
Message 3 of 3
(3,319 Views)