I'm using DrDAQ with Excel 2000 VBA on a Windows 7 computer. I'm measuring the voltage at the scope input every two seconds, continuously. This voltage is normally zero. That's all the program does except when the voltage is >2V, which might occur every few days, then other things happen.
This works fine except that every so often - about once a day, randomly - Excel crashes. Not a normal Excel error - the whole application crashes with the "Microsoft Excel has stopped working...." message. The Windows event log identifies ntdll.dll as the faulty module (see below). My fault-finding indicates the crash occurs whilst executing the UsbDrDaqGetSingle routine when the input voltage is zero.
I'm using Excel 2000 on Window 7 systems (but not with DrDAQ) on several different computers in similar continuous applications without problem. (And even with Windows 8 and 10)
The code I'm using is relatively simple (see below). I suspect a Windows problem rather than any inadequacy in my coding or problem with the DrDAQ unit. But I was wondering whether anyone might have seen this sort of thing before, or could suggest what might be going on or perhaps suggest some further diagnostic techniques?
Declare Function UsbDrDaqOpenUnit Lib "USBDrDAQ.dll" (ByRef handle As Integer) As Long
Declare Function UsbDrDaqCloseUnit Lib "USBDrDAQ.dll" (ByVal handle As Integer) As Long
Declare Function UsbDrDaqGetSingle Lib "USBDrDAQ.dll" (ByVal handle As Integer, ByVal channel As Long, ByRef value As Integer, ByRef overflow As Integer) As Long
Dim handle As Integer
Dim status As Long
Dim overflow As Integer
Dim value As Integer
status = UsbDrDaqOpenUnit(handle)
If status <> 0 Then
MsgBox "Unit not opened", vbOKOnly, "Error Message"
Call UsbDrDaqGetSingle(handle, 4, value, overflow)
USBmeasurement = value / 1000
Windows event log
Faulting application name: EXCEL.EXE, version: 126.96.36.19922, time stamp: 0x38b691e8
Faulting module name: ntdll.dll, version: 6.1.7601.19045, time stamp: 0x56258dbb
Exception code: 0xc0000005
Fault offset: 0x00052dd7
Faulting process id: 0x1098
Faulting application start time: 0x01d12724a9a2072f
Faulting application path: C:\Program Files\Microsoft Office\Office\EXCEL.EXE
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: a16a3133-9470-11e5-b9ad-896f678cf549