10-14-2011 03:56 PM
Currently I must reset my SCXI modules so I don't get bad data on the next program cycle, but I am having big issues with my USB compact DAQ chassis lately. I have to reset the chassis or all channels return zero values. How can I reset a device like cDAQ1 in VB.NET like I can reset the chassis in Max?
Thanks.
10-17-2011 10:43 AM
Hi Michael,
This article describes resetting and self testing a device programatically. I think what you're looking for is
int32 DAQmxResetDevice (const char deviceName[])
I hope this helps,
Regards,
Luke B.
10-20-2011 04:36 PM
Is that the same function call I am using? I've shown the code below, but it throws and error if I try to reset a CompactDAQ device.
Dim devices() As String = DaqSystem.Local.Devices Dim tempstring As String = "" 'Array.Sort(devices) Try For Each tempstring In devices 'MsgBox(tempstring) If Not tempstring.Contains("cDAQ") Then 'And (Not tempstring.Contains("Mod")) dvc = DaqSystem.Local.LoadDevice(tempstring) dvc.Reset() frmD.txtMessage.AppendText(vbNewLine & dvc.ToString & " reset.") Else End If Next Catch ex As Exception
10-21-2011 01:46 PM
Hi Michael,
From your code, it looks like you're trying to reset everything that isn't a cDAQ, is that right?
You might try calling a specific device like this: DaqSystem.Local.LoadDevice("cDAQ1").Reset()
Are you able to reset any other devices without the error? Does it give an error number?
Regards,
Luke B.
10-24-2011 10:02 AM
Did you guys change something in the drivers regarding this? It used to throw an error so I wrote out cDAQ devices. Now the same code does not throw an error.
10-25-2011 04:49 PM
Hi Michael,
Did you install a new driver? That's the only way something would have changed. I'd guess that there was a typo, etc. that you caught somewhere along the line.
I'm glad to hear it's working now!
Regards,
Luke B.
10-26-2011 09:56 AM
Seems that the issue doesn't follow a particular device. Sometimes a device resets, sometimes it doesn't.
09:49:41 ResetDevices
NationalInstruments.DAQmx.DaqException: The specified device is not present or is not active in the system. The device may not be installed on this system, may have been unplugged, or may not be installed correctly.
Device: cDAQ1Mod4
Status Code: -88705
at nNIMSSAIL100.StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >.CheckWithName(StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >* , tCaseInsensitiveBasicString<unsigned short\,_STL::char_traits<unsigned short>\,_STL::allocator<unsigned short>\,nNIDMXS100::tLocaleConsideringWideStringComparitor\,nNIDMXS100::tLocaleConsideringWideStringCaseForcer>* pName)
at NationalInstruments.DAQmx.Device.Reset()
at DEER_DAQ.modFunctions.ResetDevices()
09:51:14 ResetDevices
NationalInstruments.DAQmx.DaqException: Device identifier is invalid.
Device Specified: cDAQ1Mod3
Valid Values: cDAQ1, cDAQ2, cDAQ1Mod1, cDAQ1Mod2, Dev1, Dev2, Dev3
Status Code: -200220
at nNIMSSAIL100.StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >.CheckWithName(StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >* , tCaseInsensitiveBasicString<unsigned short\,_STL::char_traits<unsigned short>\,_STL::allocator<unsigned short>\,nNIDMXS100::tLocaleConsideringWideStringComparitor\,nNIDMXS100::tLocaleConsideringWideStringCaseForcer>* pName)
at nNIMSSAIL100.StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >.Check(StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >* )
at nNIMSSAIL100.ThrowIfDeviceDoesNotExist<class nNIMSSAIL100::ApiTraits<class nNIMSSAIL100::DotNetApi> >(tCaseInsensitiveBasicString<unsigned short\,_STL::char_traits<unsigned short>\,_STL::allocator<unsigned short>\,nNIDMXS100::tLocaleConsideringWideStringComparitor\,nNIDMXS100::tLocaleConsideringWideStringCaseForcer>* strName, StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >* status)
at NationalInstruments.DAQmx.DaqSystem.LoadDevice(String deviceName)
at DEER_DAQ.modFunctions.ResetDevices()
10-27-2011 06:35 PM
Hi Michael,
Is there a pattern to when it resets successfully/fails? Is it if you try and reset immediately after reseting another module? Is it usually after a crash or some other error?
Regards,
Luke B.
10-27-2011 06:42 PM
I have this issue every single time I run in this particular machine. I don't have the issue on other machines, but I have not tested it quite as much elsewhere either.
10-27-2011 07:20 PM
I think I have fixed it. I noticed that in MAX when you reset a chassis it takes a few seconds to refresh the modules. I might have been trying to reset modules that had not been refreshed. I only reset the chassis now and I put a 2 second sleep function in to allow for all modules to refresh before creating DAQmx tasks. Seems to have worked...
Thanks.