On DMM 4060 board, sometimes get bad reading of resistance from 20.xx ----12.xx ohms. I should expect a reading about 2.xx ohms. The bad reading is not repeatable. I re-read the board again, most time, I will get good reading again. Please Help!
Here is my code in Visual Basic 6:
r64Range = 10#
r64Resolution = 0.01
Status = -1
Emit ("Open a session....")
'mstrResource = "DAQ::" & Format$(miNIDeviceNumber, "0") & "::INSTR"
'Open a session to the instrument
iStatus = niDMM_init(mstrResource, VI_TRUE, VI_TRUE, miDeviceHandler)
If iStatus >= VI_SUCCESS Then
Call Writeln("OK.")
Emit ("Configure Resistance Measurement ....")
iStatus = niDMM_ConfigureMeasurement(miDeviceHandler, NIDMM_VAL_2_WIRE_RES, r64Range, r64Resolution)
If CheckError(iStatus) = VI_FALSE Then
Call Writeln("OK.")
Call Emit("Configure Multi Point....")
' SAMPLE_COUNT = 6, SAMPLE_INTERVAL_SECOND = 1 second, TRIGGER_COUNT = 1
iStatus = niDMM_ConfigureMultiPoint(miDeviceHandler, TRIGGER_COUNT, SAMPLE_COUNT, NIDMM_VAL_IMMEDIATE, SAMPLE_INTERVAL_SECOND)
If CheckError(iStatus) = VI_FALSE Then
Call Writeln("OK.")
Call Writeln("Measure Resistance....")
'Read the measurements
iStatus = niDMM_ReadMultiPoint(miDeviceHandler, TIMEOUT_LIMINT_MILLI_SECOND, SAMPLE_COUNT, r64MeasArray(1), i32NumPointsRead)
If CheckError(iStatus) = VI_FALSE And i32NumPointsRead > 0 Then
'Status = 0
'Format and display measurements
iGoodSampleCount = 0
For i = 1 To i32NumPointsRead
If IsNumeric(Str$(r64MeasArray(i))) Then
If 0 < r64MeasArray(i) And r64MeasArray(i) < r64Range Then
'only sum up the goog data
dReading = dReading + r64MeasArray(i)
iGoodSampleCount = iGoodSampleCount + 1
End If
Writeln ("Readout " & Format$(r64MeasArray(i), "##0.000000 ") & vbCrLf)
Else
Status = -2
dReading = OVER_RANGE
Writeln ("Over Range" & vbCrLf)
Exit For
End If
Next i
If Status < 2 And (i32NumPointsRead - iGoodSampleCount) < BAD_SAMPLE_COUNT_MAX Then
Status = 0
dReading = dReading / iGoodSampleCount
Writeln ("Ave Read out " & Format$(dReading, "##0.000000") & " Ohms")
Else
Status = -1
Writeln ("Too many bad samples. No valid reading")
End If
Else
Writeln ("Failed")
RaiseEvent ErrorOccurred(PalletID, iStatus, "Failed to read the device", "ResistanceReadout", mstrParameterList)
End If
Else
Writeln ("Failed")
RaiseEvent ErrorOccurred(PalletID, iStatus, "Failed to configure the device", "ResistanceReadout", mstrParameterList)
End If
Else
Writeln ("Failed")
RaiseEvent ErrorOccurred(PalletID, iStatus, "Failed to configure the device", "ResistanceReadout", mstrParameterList)
End If
Else
Call Writeln("Failed.")
RaiseEvent ErrorOccurred(PalletID, iStatus, "Failed to initialize the device", "ResistanceReadout", mstrParameterList)
End If